├── .babelrc ├── .gitignore ├── CNAME ├── LICENSE ├── README.md ├── package.json ├── src ├── app.js ├── app.vue ├── components │ ├── alert.vue │ ├── barBottom.vue │ ├── barTop.vue │ ├── button.vue │ ├── card.vue │ ├── list.vue │ ├── loading.vue │ └── text.vue ├── images │ ├── banner.jpg │ ├── easy-vue.jpg │ ├── logo-3.png │ └── phone.png ├── index.html ├── mock │ └── api.json ├── router │ └── index.js ├── store │ └── index.js └── views │ ├── detail.vue │ ├── home.vue │ ├── lists.vue │ └── option.vue ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | bower_components 4 | dist 5 | npm-debug.log 6 | # index.html 7 | yarn-error.log 8 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | vue.tigerb.cn 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Awe 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

Easy Vue

7 | 8 |

9 | Build Status 10 | Version 11 | Downloads 12 | License 13 | 14 |

15 | 16 | ## Learn Vue Easily 17 | 18 | > An easy example using Vue2 to implement easy web 19 | 20 |

21 | 22 |

23 | 24 | ## Dependence 25 | Dependence |Version 26 | -------------------|------- 27 | Vue |2.6.10 28 | Vuex |3.1.1 29 | Webpack |4.32.2 30 | 31 | ## Latest Version 0.8.0(2019/05/26) 32 | - 0.8.0 [2019/05/26] 33 | + use webpack 4.32.2 34 | + use vue 2.6.10 35 | - 0.7.2 [2017/11/12] 36 | + refactor ui for card component 37 | - 0.7.1 [2017/06/20] 38 | + separate router, store and vendor css from app.js 39 | + format code style 40 | + use webpack 3.0.0 41 | - 0.7.0 [2017/03/24] 42 | + with a cool logo 43 | + use webpack2 44 | + use json file to mock api 45 | + use vue-resource 46 | - 0.6.1 [2017/03/06] 47 | + use yarn 48 | - 0.6.0 [2016/12/08] 49 | + fix not require fastclick from node_modules 50 | + rename view 51 | + add component alert, list, button, text 52 | + add view detail 53 | + update component barBottom, barTop 54 | + update view list&option by use component list&button 55 | - 0.5.1 [2016/11/25] 56 | + do not rely on bower 57 | - 0.5.0 [2016/11/22] 58 | + use vue 2.0 59 | + use vuex 2.0 60 | - 0.3.0 [2016/09/13] 61 | + change UI for easy-vue 62 | + use vue-progressbar 63 | + add loading animation component in src/components 64 | + optimize card.vue 65 | - 0.2.0 66 | + implements page change 67 | + optimize UI 68 | 69 | > [latest version download](https://github.com/TIGERB/easy-vue/releases/tag/v0.7.1) 70 | 71 | ## Demo 72 | 73 | > 74 | 75 | ## How To Use ? 76 | 77 | ``` 78 | step 1: yarn install 79 | 80 | step 2: 81 | - develop: yarn run dev 82 | - build : yarn run build, and use *lite-server* or *http-server* to visit the dist directory 83 | 84 | ``` 85 | 86 | ## APPRECIATION 87 | 88 | 89 | 90 | ## Contributors 91 | 92 | This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. 93 | 94 | 95 | 96 | ## Backers 97 | 98 | Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/easy-vue#backer)] 99 | 100 | 101 | 102 | 103 | ## Sponsors 104 | 105 | Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/easy-vue#sponsor)] 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "easy-vue", 3 | "version": "0.8.0", 4 | "description": "Learn Vue Easily", 5 | "main": "index.js", 6 | "scripts": { 7 | "clean": "rm -rf dist", 8 | "dev": "npm run clean && webpack-dev-server -d --open --progress", 9 | "build": "npm run clean && NODE_ENV=production webpack -p --hide-modules --progress" 10 | }, 11 | "author": "TIGERB", 12 | "license": "MIT", 13 | "dependencies": { 14 | "animate.css": "^3.5.2", 15 | "babel": "^6.23.0", 16 | "font-awesome": "^4.7.0", 17 | "mini-css-extract-plugin": "^0.6.0", 18 | "opencollective": "^1.0.3", 19 | "ratchet-npm": "^2.0.4", 20 | "vue": "^2.6.10", 21 | "vue-infinite-scroll": "^2.0.2", 22 | "vue-progressbar": "^0.7.5", 23 | "vue-resource": "^1.3.0", 24 | "vue-router": "^3.0.6", 25 | "vue-template-compiler": "^2.6.10", 26 | "vuex": "^3.1.1" 27 | }, 28 | "devDependencies": { 29 | "babel-cli": "^6.26.0", 30 | "babel-core": "^6.26.3", 31 | "babel-loader": "7", 32 | "babel-plugin-transform-runtime": "^6.4.3", 33 | "babel-preset-es2015": "^6.24.1", 34 | "babel-runtime": "^6.23.0", 35 | "copy-webpack-plugin": "^5.0.3", 36 | "css-loader": "^2.1.1", 37 | "file-loader": "^3.0.1", 38 | "html-webpack-plugin": "^3.2.0", 39 | "style-loader": "^0.18.2", 40 | "vue-loader": "^15.7.0", 41 | "vue-style-loader": "^4.1.2", 42 | "webpack": "^4.32.2", 43 | "webpack-cli": "^3.3.2", 44 | "webpack-dev-server": "^3.4.1" 45 | }, 46 | "collective": { 47 | "type": "opencollective", 48 | "url": "https://opencollective.com/easy-vue" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/app.js: -------------------------------------------------------------------------------- 1 | import 'ratchet-npm/dist/css/ratchet.css'; // get ratchet 2 | import 'font-awesome/css/font-awesome.css'; // get font-awesome 3 | import 'animate.css/animate.css'; // get animate.css 4 | 5 | // import FastClick from 'fastclick'; 6 | import Vue from 'vue'; // get vue 7 | import VueProgressBar from 'vue-progressbar'; // get vue-progressbar 8 | import InfiniteScroll from 'vue-infinite-scroll'; // get vue-infinite-scroll 9 | 10 | import App from './app.vue'; // get root module 11 | import router from './router'; 12 | import store from './store'; // get vuex -> store 13 | 14 | // FastClick.attach(document.body); // init fastclick 15 | const options = { 16 | color: '#fff', 17 | failedColor: '#874b4b', 18 | thickness: '3px', 19 | transition: { 20 | speed: '0.2s', 21 | opacity: '0.6s' 22 | }, 23 | autoRevert: true, 24 | location: 'top', 25 | inverse: false 26 | }; 27 | Vue.use(VueProgressBar, options); 28 | Vue.use(InfiniteScroll); 29 | 30 | // init 31 | const app = new Vue({ 32 | router, 33 | store, 34 | render: h => h(App), 35 | }).$mount('#app'); 36 | -------------------------------------------------------------------------------- /src/app.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | -------------------------------------------------------------------------------- /src/components/alert.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 34 | 35 | 76 | -------------------------------------------------------------------------------- /src/components/barBottom.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 50 | 51 | 64 | -------------------------------------------------------------------------------- /src/components/barTop.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 39 | 40 | 48 | -------------------------------------------------------------------------------- /src/components/button.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | 70 | 71 | 87 | -------------------------------------------------------------------------------- /src/components/card.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 67 | 68 | 140 | -------------------------------------------------------------------------------- /src/components/list.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 55 | 56 | 61 | -------------------------------------------------------------------------------- /src/components/loading.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 21 | 22 | 32 | -------------------------------------------------------------------------------- /src/components/text.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 21 | 22 | 36 | -------------------------------------------------------------------------------- /src/images/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TIGERB/easy-vue/3dd7458ca717a055b5e893a6a01b1fc57cd549ca/src/images/banner.jpg -------------------------------------------------------------------------------- /src/images/easy-vue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TIGERB/easy-vue/3dd7458ca717a055b5e893a6a01b1fc57cd549ca/src/images/easy-vue.jpg -------------------------------------------------------------------------------- /src/images/logo-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TIGERB/easy-vue/3dd7458ca717a055b5e893a6a01b1fc57cd549ca/src/images/logo-3.png -------------------------------------------------------------------------------- /src/images/phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TIGERB/easy-vue/3dd7458ca717a055b5e893a6a01b1fc57cd549ca/src/images/phone.png -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | easy-vue 8 | 9 | 10 |

11 | 12 | 13 | -------------------------------------------------------------------------------- /src/mock/api.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "img": "http://cdn.tigerb.cn/WechatIMG129.jpeg", 4 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 5 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 6 | "nickname": "TIGERB", 7 | "date": "2017-11-12" 8 | }, 9 | { 10 | "img": "http://cdn.tigerb.cn/WechatIMG122.jpeg", 11 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 12 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 13 | "nickname": "TIGERB", 14 | "date": "2017-11-12" 15 | }, 16 | { 17 | "img": "http://cdn.tigerb.cn/WechatIMG123.jpeg", 18 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 19 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 20 | "nickname": "TIGERB", 21 | "date": "2017-11-12" 22 | }, 23 | { 24 | "img": "http://cdn.tigerb.cn/WechatIMG127.jpeg", 25 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 26 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 27 | "nickname": "TIGERB", 28 | "date": "2017-11-12" 29 | }, 30 | { 31 | "img": "http://cdn.tigerb.cn/WechatIMG133.jpeg", 32 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 33 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 34 | "nickname": "TIGERB", 35 | "date": "2017-11-12" 36 | }, 37 | { 38 | "img": "http://cdn.tigerb.cn/WechatIMG132.jpeg", 39 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 40 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 41 | "nickname": "TIGERB", 42 | "date": "2017-11-12" 43 | }, 44 | { 45 | "img": "http://cdn.tigerb.cn/WechatIMG135.jpeg", 46 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 47 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 48 | "nickname": "TIGERB", 49 | "date": "2017-11-12" 50 | }, 51 | { 52 | "img": "http://cdn.tigerb.cn/WechatIMG131.jpeg", 53 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 54 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 55 | "nickname": "TIGERB", 56 | "date": "2017-11-12" 57 | }, 58 | { 59 | "img": "http://cdn.tigerb.cn/WechatIMG126.jpeg", 60 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 61 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 62 | "nickname": "TIGERB", 63 | "date": "2017-11-12" 64 | }, 65 | { 66 | "img": "http://cdn.tigerb.cn/WechatIMG125.jpeg", 67 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 68 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 69 | "nickname": "TIGERB", 70 | "date": "2017-11-12" 71 | }, 72 | { 73 | "img": "http://cdn.tigerb.cn/WechatIMG128.jpeg", 74 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 75 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 76 | "nickname": "TIGERB", 77 | "date": "2017-11-12" 78 | }, 79 | { 80 | "img": "http://cdn.tigerb.cn/WechatIMG124.jpeg", 81 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 82 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 83 | "nickname": "TIGERB", 84 | "date": "2017-11-12" 85 | }, 86 | { 87 | "img": "http://cdn.tigerb.cn/WechatIMG131.jpeg", 88 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 89 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 90 | "nickname": "TIGERB", 91 | "date": "2017-11-12" 92 | }, 93 | { 94 | "img": "http://cdn.tigerb.cn/WechatIMG134.jpeg", 95 | "content": "Youth is not a time of life, it is a state of mind, it is not a matter of rosy cheeks, red lips and supple knees, it is a matter of the will, a quality of the imagination, a vigor of the emotions, it is the freshness of the deep springs of life.", 96 | "avatar": "http://cdn.tigerb.cn/2623124159-59fd8c6c56254_huge256.jpeg", 97 | "nickname": "TIGERB", 98 | "date": "2017-11-12" 99 | } 100 | ] 101 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import VueRouter from 'vue-router'; 3 | 4 | import Home from '../views/home.vue'; 5 | import Lists from '../views/lists.vue'; 6 | import Option from '../views/option.vue'; 7 | import Detail from '../views/detail.vue'; 8 | 9 | Vue.use(VueRouter); 10 | 11 | const routes = [ 12 | { path: '/', component: Home }, 13 | { path: '/lists', component: Lists }, 14 | { path: '/option', component: Option }, 15 | { path: '/detail', component: Detail }, 16 | ]; 17 | 18 | const router = new VueRouter({routes}); 19 | 20 | export default router; 21 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; // get vue 2 | import Vuex from 'vuex'; // get vuex 3 | import VueResource from 'vue-resource';// get $http 4 | 5 | Vue.use(Vuex); 6 | Vue.use(VueResource); 7 | 8 | const state = { 9 | cardData: [], 10 | isloadingComplete: false, 11 | busy: false, 12 | isShow: false, 13 | }; 14 | 15 | const getters = {}; 16 | 17 | const mutations = { 18 | updateLoadingState(state, data) { 19 | state.isloadingComplete = data; 20 | }, 21 | updateBusyState(state, data) { 22 | state.busy = data; 23 | }, 24 | addData(state, data) { 25 | state.cardData = state.cardData.concat(data); 26 | }, 27 | refreshData(state, data) { 28 | state.cardData = data; 29 | }, 30 | isShowAlert(state, data) { 31 | state.isShow = data; 32 | }, 33 | }; 34 | 35 | const actions = { 36 | getData(context, object) { 37 | const {progress, isRefresh} = object; 38 | const mutationName = isRefresh === true ? 'refreshData' : 'addData'; 39 | progress.$Progress.start(); 40 | context.commit('updateLoadingState', false); 41 | context.commit('updateBusyState', true); 42 | 43 | /** 44 | * use vue-resource 45 | */ 46 | Vue.http.get('/mock/api.json').then((response) => { 47 | const json = response.data; 48 | context.commit('updateLoadingState', true); 49 | context.commit('updateBusyState', false); 50 | context.commit(mutationName, json); 51 | progress.$Progress.finish(); 52 | }, () => { 53 | context.commit('updateBusyState', false); 54 | progress.$Progress.fail(); 55 | }); 56 | } 57 | 58 | }; 59 | 60 | const store = new Vuex.Store({ 61 | state, 62 | getters, 63 | mutations, 64 | actions, 65 | }); 66 | 67 | export default store; 68 | -------------------------------------------------------------------------------- /src/views/detail.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 25 | 26 | 29 | -------------------------------------------------------------------------------- /src/views/home.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 31 | 32 | 35 | -------------------------------------------------------------------------------- /src/views/lists.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 31 | 32 | 35 | -------------------------------------------------------------------------------- /src/views/option.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 34 | 35 | 40 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var path = require('path'); 3 | var htmlWebpackPlugin = require('html-webpack-plugin'); 4 | // var extractTextPlugin = require('extract-text-webpack-plugin'); // separate css 5 | var miniCssExtractPlugin = require('mini-css-extract-plugin') 6 | var copyWebpackPlugin = require('copy-webpack-plugin'); 7 | var vueLoaderPlugin = require('vue-loader/lib/plugin') 8 | 9 | var webpackConfig = module.exports = {}; // init object 10 | var isProduction = process.env.NODE_ENV === 'production'; // production environment 11 | 12 | // input 13 | webpackConfig.entry = { 14 | app: './src/app.js', // main 15 | }; 16 | 17 | // output 18 | webpackConfig.output = { 19 | path: path.resolve(__dirname, 'dist'), 20 | publicPath: '/', 21 | filename: isProduction ? '[name].[hash].js' : '[name].js', 22 | }; 23 | 24 | // loader 25 | webpackConfig.module = { 26 | rules: [ 27 | { 28 | test: /\.css$/, 29 | use: [ 30 | miniCssExtractPlugin.loader, 31 | "css-loader" 32 | ], 33 | }, 34 | { 35 | test: /\.vue$/, 36 | loader: 'vue-loader', 37 | }, 38 | { 39 | test: /\.js$/, 40 | loader: 'babel-loader', 41 | exclude: /node_modules/, 42 | }, 43 | { 44 | test: /\.(eot(|\?v=.*)|woff(|\?v=.*)|woff2(|\?v=.*)|ttf(|\?v=.*)|svg(|\?v=.*))$/, 45 | loader: 'file-loader', 46 | options: { name: 'fonts/[name].[ext]' }, 47 | }, 48 | { 49 | test: /\.(png|jpg|gif)$/, 50 | loader: 'file-loader', 51 | }, 52 | ] 53 | }; 54 | 55 | webpackConfig.plugins = [ 56 | // make index.html 57 | new htmlWebpackPlugin({ 58 | template: './src/index.html' 59 | }), 60 | // separate css file 61 | new miniCssExtractPlugin({ 62 | filename: isProduction ? 'app.[hash].css' : 'app.css', 63 | // disable: false, 64 | // allChunks: true 65 | }), 66 | new webpack.DefinePlugin({ 67 | 'process.env': { 68 | NODE_ENV: '"production"' 69 | } 70 | }), 71 | new copyWebpackPlugin([ 72 | { from: 'src/mock/api.json', to: 'mock' }, 73 | { context: 'src/images', from: '*', to: path.join(__dirname, 'dist', 'images') } 74 | ]), 75 | new vueLoaderPlugin() 76 | ]; 77 | 78 | if (!isProduction) { 79 | webpackConfig.devServer = { 80 | contentBase: path.resolve(__dirname, 'dist'), 81 | compress: true, 82 | historyApiFallback: true, 83 | }; 84 | } 85 | --------------------------------------------------------------------------------