├── .babelrc ├── .browserslistrc ├── .editorconfig ├── .env ├── .env.local ├── .env.production ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── LICENSE ├── README.md ├── babel.config.js ├── dist ├── favicon.ico ├── index.html └── static │ ├── css │ ├── app.dfcc6672.css │ └── home.ebfbb232.css │ └── js │ ├── app.6676dd50.js │ ├── home.19c33026.js │ ├── vendor.8c3e1f68.js │ └── vendor.8c3e1f68.js.gz ├── package.json ├── postcss.config.js ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── api │ ├── articles.js │ └── fetch.js ├── assets │ └── css │ │ └── common.less ├── lib │ └── utils.js ├── main.js ├── router │ └── index.js ├── store │ ├── index.js │ └── modules │ │ └── articles.js └── views │ └── index.vue ├── vue.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [] 3 | } 4 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not ie <= 8 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js, jsx, ts, tsx, vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | NODE_ENV = 'development' 2 | PUBLIC_PATH = '/' 3 | VUE_APP_BASE_API='https://www.boblog.com/api/v1' 4 | -------------------------------------------------------------------------------- /.env.local: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfb/vue-cli3-template/fd466e24a86e11e05543748fd1f243427755013a/.env.local -------------------------------------------------------------------------------- /.env.production: -------------------------------------------------------------------------------- 1 | NODE_ENV = 'production' 2 | PUBLIC_PATH = '/' 3 | VUE_APP_BASE_API='https://api.com/api/v1' 4 | 5 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /cmas/ 4 | /node_modules/ 5 | /src/utils/ 6 | /tests/unit/ 7 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | }, 6 | extends: [ 7 | 'plugin:vue/essential', 8 | '@vue/airbnb', 9 | ], 10 | parserOptions: { 11 | parser: 'babel-eslint', 12 | }, 13 | rules: { 14 | 'no-console': 'off', 15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.idea 13 | *.pid.lock 14 | 15 | # Directory for instrumented libs generated by jscoverage/JSCover 16 | lib-cov 17 | 18 | # Coverage directory used by tools like istanbul 19 | coverage 20 | 21 | # nyc test coverage 22 | .nyc_output 23 | 24 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 25 | .grunt 26 | 27 | # Bower dependency directory (https://bower.io/) 28 | bower_components 29 | 30 | # node-waf configuration 31 | .lock-wscript 32 | 33 | # Compiled binary addons (https://nodejs.org/api/addons.html) 34 | build/Release 35 | 36 | # Dependency directories 37 | node_modules/ 38 | jspm_packages/ 39 | 40 | # TypeScript v1 declaration files 41 | typings/ 42 | 43 | # Optional npm cache directory 44 | .npm 45 | 46 | # Optional eslint cache 47 | .eslintcache 48 | 49 | # Optional REPL history 50 | .node_repl_history 51 | 52 | # Output of 'npm pack' 53 | *.tgz 54 | 55 | # Yarn Integrity file 56 | .yarn-integrity 57 | 58 | # dotenv environment variables file 59 | # .env 60 | 61 | # next.js build output 62 | .next 63 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 梁凤波 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 | 基于 Vue-cli3 搭建的前端开发脚手架项目模板,主要包括有以下内容:Webpack4.x 性能调优配置,Vue.js 全家桶,移动端 vw 适配,单元测试等功能,仅供参考,欢迎大家围观指教! 3 | 4 | ## 项目特点 5 | [](https://github.com/vuejs/vue) 6 | [](https://github.com/liangfengbo/vue-cli3-template/blob/master/LICENSE) 7 | 8 | ## 特征 9 | - [x] Babel 10 | - [x] VueRouter 11 | - [x] Vuex 12 | - [x] CSS 预编译工具:Less 13 | - [x] HTTP 库:Axios 14 | - [x] 代码规范:eslint airbnb 规范 15 | - [x] 业务代码和第三方库区分打包:DllPlugin 16 | - [x] 删除冗余代码:UglifyJsPlugin 17 | - [x] 开启 Gizp 压缩:compression-webpack-plugin 18 | - [x] 配置引入公共样式文件 19 | - [x] 使用 alias 简化路径 20 | - [x] vw 移动端适配 21 | - [x] 文件结构可视化:webpack-bundle-analyzer 22 | 23 | ## 安装及快速开始 24 | ``` 25 | # 克隆项目 26 | $ git clone https://github.com/liangfengbo/vue-cli3-template 27 | 28 | # 进入目录 29 | $ cd vue-cli3-template 30 | 31 | # 安装依赖包 32 | $ yarn install 33 | 34 | # 启动项目 35 | $ yarn serve 36 | 37 | # eslint 检测 38 | $ yarn lint 39 | 40 | # eslint 修复 41 | $ yarnr lint --fix 42 | 43 | # 项目构建打包 44 | $ yarn run build 45 | 46 | # 项目构建打包分析 47 | $ yarn run build --report 48 | 49 | # 现代模式打包 50 | $ yarn build --modren 51 | ``` 52 | 53 | ## FAQ 54 | 1. 没有yarn环境,npm 可以吗? 55 | > 答:可以的,建议使用 yarn,yarn 比 npm 速度快,主要是安装版本统一。 56 | 2. vue.config.js 里面的一些配置可以不需要吗?或者我新增一些配置可以吗? 57 | > 答:可以的,你可以根据你的实际需要进行修改或增删配置的,比如你不需要 开启 Gizp 压缩,你在 vue.config.js 里面删除 开启gzip 内容即可。且 env 文件, 代理服务器的接口或转发路径,这些肯定需要改为你实际开发中的接口路径的。 58 | 3. ... 更多问题请到 [Issues](https://github.com/liangfengbo/vue-cli3-template/issues)查阅,或者有问题请到 [Issues 提问](https://github.com/liangfengbo/vue-cli3-template/issues/new),我会及时回复的,如果对你有帮助,请你点个 star 鼓励一下,谢谢!共勉! 59 | ### MIT 60 | [@梁凤波](https://github.com/liangfengbo/vue-cli3-template/blob/master/LICENSE) 61 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset', 4 | ] 5 | }; 6 | -------------------------------------------------------------------------------- /dist/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lfb/vue-cli3-template/fd466e24a86e11e05543748fd1f243427755013a/dist/favicon.ico -------------------------------------------------------------------------------- /dist/index.html: -------------------------------------------------------------------------------- 1 |