├── src ├── assets │ ├── stylesheets │ │ └── global.scss │ ├── vue.png │ ├── webpack.png │ └── fontello │ │ ├── font │ │ ├── fontello.eot │ │ ├── fontello.ttf │ │ ├── fontello.woff │ │ ├── fontello.woff2 │ │ └── fontello.svg │ │ └── css │ │ └── fontello.css ├── pages │ ├── 404.vue │ └── index.vue ├── app.vue ├── index.js ├── index.ejs └── router.js ├── postcss.config.js ├── static └── favicon.jpeg ├── .gitignore ├── .eslintrc.js ├── .babelrc ├── package.json └── README.md /src/assets/stylesheets/global.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | -------------------------------------------------------------------------------- /src/pages/404.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /src/assets/vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmk123/webpack-boilerplate/HEAD/src/assets/vue.png -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('autoprefixer') 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /static/favicon.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmk123/webpack-boilerplate/HEAD/static/favicon.jpeg -------------------------------------------------------------------------------- /src/assets/webpack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmk123/webpack-boilerplate/HEAD/src/assets/webpack.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /dist/ 3 | .DS_Store 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | -------------------------------------------------------------------------------- /src/assets/fontello/font/fontello.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmk123/webpack-boilerplate/HEAD/src/assets/fontello/font/fontello.eot -------------------------------------------------------------------------------- /src/assets/fontello/font/fontello.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmk123/webpack-boilerplate/HEAD/src/assets/fontello/font/fontello.ttf -------------------------------------------------------------------------------- /src/assets/fontello/font/fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmk123/webpack-boilerplate/HEAD/src/assets/fontello/font/fontello.woff -------------------------------------------------------------------------------- /src/assets/fontello/font/fontello.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmk123/webpack-boilerplate/HEAD/src/assets/fontello/font/fontello.woff2 -------------------------------------------------------------------------------- /src/app.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import 'normalize.css/normalize.css' 2 | import './assets/fontello/css/fontello.css' 3 | import './assets/stylesheets/global.scss' 4 | 5 | import Vue from 'vue' 6 | import App from './app.vue' 7 | 8 | document.body.appendChild(new Vue(App).$mount().$el) 9 | -------------------------------------------------------------------------------- /src/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Hello Webpack 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: 'babel-eslint', 3 | parserOptions: { 4 | ecmaVersion: 6, 5 | sourceType: 'module' 6 | }, 7 | env: { 8 | browser: true, 9 | es6: true 10 | }, 11 | plugins: [ 12 | 'html' 13 | ], 14 | extends: [ 15 | 'standard' 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /src/router.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | 4 | Vue.use(VueRouter) 5 | 6 | const router = new VueRouter({ 7 | routes: [ 8 | { 9 | path: '/', 10 | name: '首页', 11 | component: () => import('./pages/index.vue') 12 | }, 13 | { 14 | path: '*', 15 | name: '404', 16 | component: () => import('./pages/404.vue') 17 | } 18 | ] 19 | }) 20 | 21 | export default router 22 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "env", 5 | { 6 | "targets": { 7 | "browsers": [ 8 | "last 2 versions" 9 | ] 10 | }, 11 | "modules": false, 12 | "loose": true, 13 | "debug": false, 14 | "exclude": [ 15 | "transform-async-to-generator", 16 | "transform-regenerator", 17 | "transform-es2015-typeof-symbol", 18 | "transform-es2015-unicode-regex", 19 | "transform-regenerator", 20 | "transform-es2015-for-of" 21 | ] 22 | } 23 | ] 24 | ], 25 | "plugins": [ 26 | "syntax-dynamic-import", 27 | [ 28 | "transform-runtime", 29 | { 30 | "helpers": true, 31 | "polyfill": false, 32 | "regenerator": false 33 | } 34 | ] 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /src/pages/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 41 | -------------------------------------------------------------------------------- /src/assets/fontello/css/fontello.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'fontello'; 3 | src: url('../font/fontello.eot?10499253'); 4 | src: url('../font/fontello.eot?10499253#iefix') format('embedded-opentype'), 5 | url('../font/fontello.woff2?10499253') format('woff2'), 6 | url('../font/fontello.woff?10499253') format('woff'), 7 | url('../font/fontello.ttf?10499253') format('truetype'), 8 | url('../font/fontello.svg?10499253#fontello') format('svg'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */ 13 | /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */ 14 | /* 15 | @media screen and (-webkit-min-device-pixel-ratio:0) { 16 | @font-face { 17 | font-family: 'fontello'; 18 | src: url('../font/fontello.svg?10499253#fontello') format('svg'); 19 | } 20 | } 21 | */ 22 | 23 | [class^="icon-"]:before, [class*=" icon-"]:before { 24 | font-family: "fontello"; 25 | font-style: normal; 26 | font-weight: normal; 27 | speak: none; 28 | 29 | display: inline-block; 30 | text-decoration: inherit; 31 | width: 1em; 32 | margin-right: .2em; 33 | text-align: center; 34 | /* opacity: .8; */ 35 | 36 | /* For safety - reset parent styles, that can break glyph codes*/ 37 | font-variant: normal; 38 | text-transform: none; 39 | 40 | /* fix buttons height, for twitter bootstrap */ 41 | line-height: 1em; 42 | 43 | /* Animation center compensation - margins should be symmetric */ 44 | /* remove if not needed */ 45 | margin-left: .2em; 46 | 47 | /* you can be more comfortable with increased icons size */ 48 | /* font-size: 120%; */ 49 | 50 | /* Font smoothing. That was taken from TWBS */ 51 | -webkit-font-smoothing: antialiased; 52 | -moz-osx-font-smoothing: grayscale; 53 | 54 | /* Uncomment for 3D effect */ 55 | /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ 56 | } 57 | 58 | .icon-github-circled:before { content: '\f09b'; } /* '' */ 59 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "browserslist": [ 3 | "last 2 versions" 4 | ], 5 | "private": true, 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/lmk123/webpack-boilerplate.git" 9 | }, 10 | "scripts": { 11 | "start": "webpack-dev-server --watch --config build/webpack.dev.config.js", 12 | "build": "webpack --config build/webpack.prod.config.js", 13 | "lint": "eslint --ignore-pattern '/dist/' '**/*.{js,vue}'" 14 | }, 15 | "dependencies": { 16 | "normalize.css": "^7.0.0", 17 | "vue": "^2.5.2", 18 | "vue-router": "^3.0.1" 19 | }, 20 | "devDependencies": { 21 | "autoprefixer": "^7.1.5", 22 | "babel-core": "^6.26.0", 23 | "babel-eslint": "^8.0.1", 24 | "babel-loader": "^7.1.2", 25 | "babel-plugin-syntax-dynamic-import": "^6.18.0", 26 | "babel-plugin-transform-runtime": "^6.23.0", 27 | "babel-preset-env": "^1.6.0", 28 | "clean-webpack-plugin": "^0.1.17", 29 | "copy-webpack-plugin": "^4.1.1", 30 | "css-loader": "^0.28.7", 31 | "eslint": "^4.9.0", 32 | "eslint-config-standard": "^10.2.0", 33 | "eslint-plugin-html": "^3.2.2", 34 | "eslint-plugin-import": "^2.7.0", 35 | "eslint-plugin-node": "^5.2.0", 36 | "eslint-plugin-promise": "^3.6.0", 37 | "eslint-plugin-standard": "^3.0.1", 38 | "extract-text-webpack-plugin": "^3.0.1", 39 | "file-loader": "^1.1.5", 40 | "html-webpack-plugin": "^2.30.1", 41 | "node-sass": "^4.5.3", 42 | "optimize-css-assets-webpack-plugin": "^3.2.0", 43 | "postcss-loader": "^2.0.8", 44 | "qrcode-terminal": "^0.11.0", 45 | "sass-loader": "^6.0.6", 46 | "style-loader": "^0.19.0", 47 | "url-loader": "^0.6.2", 48 | "vue-loader": "^13.3.0", 49 | "vue-style-loader": "^3.0.3", 50 | "vue-template-compiler": "^2.5.2", 51 | "webpack": "^3.7.1", 52 | "webpack-dev-server": "^2.9.2", 53 | "webpack-merge": "^4.1.0" 54 | }, 55 | "author": "Mingkai Li ", 56 | "license": "MIT", 57 | "bugs": { 58 | "url": "https://github.com/lmk123/webpack-boilerplate/issues" 59 | }, 60 | "homepage": "https://github.com/lmk123/webpack-boilerplate#readme" 61 | } 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **Deprecated, use [Vue CLI](https://cli.vuejs.org/) instead.** 2 | 3 | # Webpack With Vue.js Boilerplate 4 | 5 | This is a Webpack + Vue.js boilerplate that heavy inspired by [vuejs-templates/webpack](https://github.com/vuejs-templates/webpack) with these features: 6 | 7 | - Apply [Autoprefixer](https://github.com/postcss/autoprefixer) outside of `.vue` components. See [vuejs-templates/webpack#600](https://github.com/vuejs-templates/webpack/issues/600). 8 | - Use [webpack-dev-server](https://github.com/webpack/webpack-dev-server) instead of custom develop server. 9 | - [Simple config](build/config.js). 10 | - Not lint-on-save with ESLint: run `npm run lint` instead. This make me easy to debug code temporary. 11 | - Use **relative public path** by default. See [vuejs-templates/webpack#200](https://github.com/vuejs-templates/webpack/issues/200). 12 | - Keep source map path comment in the CSS files after a production build. See [NMFR/optimize-css-assets-webpack-plugin#6](https://github.com/NMFR/optimize-css-assets-webpack-plugin/pull/6). 13 | - Apply Babel plugins with [babel-preset-env](https://github.com/babel/babel-preset-env). 14 | - Use [HashedModuleIdsPlugin](https://github.com/webpack/webpack/blob/master/lib/HashedModuleIdsPlugin.js) to keep module ids consistent. See [vuejs-templates/webpack#406](https://github.com/vuejs-templates/webpack/issues/406). 15 | - Similar to JS, also split CSS to `vendor.css` and `main.css`. See [vuejs-templates/webpack#598](https://github.com/vuejs-templates/webpack/issues/598). 16 | - Ready to use `import('./path/to/module')` syntax to [code-splitting](https://webpack.js.org/guides/code-splitting-import/). 17 | 18 | ...and other little improve. 19 | 20 | ## Usage 21 | 22 | 1. Clone this template use [Git](https://git-scm.com/) or [download it](https://github.com/vuejs-templates/webpack/archive/master.zip). 23 | 2. Install dependencies: `npm install` 24 | 25 | Now you have three commands: 26 | 27 | - `npm start` 28 | - `npm run build` 29 | - `npm run lint`: Lint code with ESLint (use [JavaScript Standard Style](https://standardjs.com/) rules) 30 | 31 | ## Trouble-shooting 32 | 33 | This boilerplate use [Sass](http://sass-lang.com/) by default so I specified `node-sass` and `sass-loader` in package.json, but if you want use [less](http://lesscss.org/) or [stylus](http://stylus-lang.com/), you need install then by yourself: 34 | 35 | ``` 36 | npm install less-loader --save-dev 37 | npm install stylus-loader --save-dev 38 | ``` 39 | 40 | **FOR CHINESE USER:** 如果你在安装 `node-sass` 时遇到问题,请参考这篇文章解决:[安装 node-sass 的正确姿势](https://github.com/lmk123/blog/issues/28) 41 | -------------------------------------------------------------------------------- /src/assets/fontello/font/fontello.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Copyright (C) 2017 by original authors @ fontello.com 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | --------------------------------------------------------------------------------