Skip to content

Commit 73b259c

Browse files
committed
Merge branch 'master' of github.com:vuejs-templates/webpack
2 parents fb0aeca + f93e45b commit 73b259c

34 files changed

+629
-304
lines changed

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ node_modules
22
.DS_Store
33
docs/_book
44
test/
5+
node_modules
6+
.DS_Store
7+
docs/_book
8+
test/

Diff for: README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ $ npm install
2121
$ npm run dev
2222
```
2323

24+
This will scaffold the project using the `master` branch. If you wish to use the latest version of the webpack template, do the following instead:
25+
26+
``` bash
27+
$ vue init webpack#develop my-project
28+
```
29+
30+
:warning: **The develop branch is not considered stable and can contain bugs or not build at all, so use at your own risk.**
31+
2432
The development server will run on port 8080 by default. If that port is already in use on your machine, the next free port will be used.
2533

2634
### Include Foundation variables in all *.vue files
@@ -47,7 +55,7 @@ stylus: generateLoaders('stylus'),
4755
- Source maps
4856

4957
- `npm run build`: Production ready build.
50-
- JavaScript minified with [UglifyJS](https://github.com/mishoo/UglifyJS2).
58+
- JavaScript minified with [UglifyJS v3](https://github.com/mishoo/UglifyJS2/tree/harmony).
5159
- HTML minified with [html-minifier](https://github.com/kangax/html-minifier).
5260
- CSS across all components extracted into a single file and minified with [cssnano](https://github.com/ben-eb/cssnano).
5361
- Static assets compiled with version hashes for efficient long-term caching, and an auto-generated production `index.html` with proper URLs to these generated assets.

Diff for: docs/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- [Project Structure](structure.md)
44
- [Build Commands](commands.md)
5+
- [Babel Configuration](babel.md)
56
- [Linter Configuration](linter.md)
67
- [Pre-Processors](pre-processors.md)
78
- [Handling Static Assets](static.md)

Diff for: docs/babel.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Babel Configuration
2+
3+
This boilerplate uses [`babel-preset-env`](https://www.npmjs.com/package/babel-preset-env) for configuring babel. You can read more about it here - http://2ality.com/2017/02/babel-preset-env.html.
4+
5+
> A Babel preset that compiles ES2015+ down to ES5 by automatically determining the Babel plugins and polyfills you need based on your targeted browser or runtime environments.
6+
7+
It uses [`browserslist`](https://github.com/ai/browserslist) to parse this information, so we can use any [valid query format supported by `browserslist`](https://github.com/ai/browserslist#queries).
8+
9+
However there is a caveat. `browserslist` recommends defining the target in a common place like `package.json` or in a `.browserslistrc` config file. This allows tools like [`autoprefixer`](https://github.com/postcss/autoprefixer) and [`eslint-plugin-compat`](https://github.com/amilajack/eslint-plugin-compat) to share the config. For this template, `browserslist` is configured in the `package.json`:
10+
11+
```json
12+
{
13+
"...": "...",
14+
"browserslist": [
15+
"> 1%",
16+
"last 2 versions",
17+
"not ie <= 8"
18+
]
19+
}
20+
```
21+
22+
But the latest stable release of `babel-preset-env`, `v1.6.1` does not support loading the config from `package.json`. So the target environment is repeated in `.babelrc`. If you wish to change your target environment, please be sure to update both `package.json` and `.babelrc`. Note that this has been fixed in the beta version([`@babel/[email protected]`](https://github.com/babel/babel/tree/master/packages/babel-preset-env)) and the template will be updated once it is out of beta.

Diff for: docs/backend.md

+21-7
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,31 @@ Let's take a look at the default `config/index.js`:
1010
const path = require('path')
1111

1212
module.exports = {
13+
dev: {
14+
/ Paths
15+
assetsSubDirectory: 'static',
16+
assetsPublicPath: '/',
17+
proxyTable: {},
18+
19+
// Various Dev Server settings
20+
host: 'localhost',
21+
port: 8080,
22+
23+
// skipping other options as they are only convenience features
24+
},
1325
build: {
14-
index: path.resolve(__dirname, 'dist/index.html'),
15-
assetsRoot: path.resolve(__dirname, 'dist'),
26+
// Template for index.html
27+
index: path.resolve(__dirname, '../dist/index.html'),
28+
29+
// Paths
30+
assetsRoot: path.resolve(__dirname, '../dist'),
1631
assetsSubDirectory: 'static',
1732
assetsPublicPath: '/',
18-
productionSourceMap: true
33+
34+
productionSourceMap: true,
35+
36+
// skipping the rest ...
1937
},
20-
dev: {
21-
port: 8080,
22-
proxyTable: {}
23-
}
2438
}
2539
```
2640

Diff for: docs/commands.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ All build commands are executed via [NPM Scripts](https://docs.npmjs.com/misc/sc
1616

1717
> Build assets for production. See [Integrating with Backend Framework](backend.md) for more details.
1818
19-
- JavaScript minified with [UglifyJS](https://github.com/mishoo/UglifyJS2).
19+
- JavaScript minified with [UglifyJS v3](https://github.com/mishoo/UglifyJS2/tree/harmony).
2020
- HTML minified with [html-minifier](https://github.com/kangax/html-minifier).
2121
- CSS across all components extracted into a single file and minified with [cssnano](https://github.com/ben-eb/cssnano).
2222
- All static assets compiled with version hashes for efficient long-term caching, and a production `index.html` is auto-generated with proper URLs to these generated assets.
@@ -36,3 +36,7 @@ All build commands are executed via [NPM Scripts](https://docs.npmjs.com/misc/sc
3636
- Works with one command out of the box:
3737
- Selenium and chromedriver dependencies automatically handled.
3838
- Automatically spawns the Selenium server.
39+
40+
### `npm run lint`
41+
42+
> Runs eslint and reports any linting errors in your code. See [Linter Configuration](linter.md)

Diff for: docs/linter.md

+11
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,14 @@ If you are not happy with the default linting rules, you have several options:
1414
2. Pick a different ESLint preset when generating the project, for example [eslint-config-airbnb](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb).
1515

1616
3. Pick "none" for ESLint preset when generating the project and define your own rules. See [ESLint documentation](https://eslint.org/docs/rules/) for more details.
17+
18+
## Fixing Linting Errors
19+
20+
You can run the following command to let eslint fix any errors it finds (if it can - not all errors are fixable like this):
21+
22+
```
23+
npm run lint -- --fix
24+
```
25+
26+
*(The `--` in the middle is necessary to ensure the `--fix` option is passdd to `eslint`, not to `npm`)*
27+

Diff for: docs/pre-processors.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,18 @@ Once installed, you can use the pre-processors inside your `*.vue` components us
2525

2626
### PostCSS
2727

28-
Styles in `*.vue` files are piped through PostCSS by default, so you don't need to use a specific loader for it. You can simply add PostCSS plugins you want to use in `build/webpack.base.conf.js` under the `vue` block:
28+
Styles in `*.vue` files and style files (`*.css`, `*.scss` etc) are piped through PostCSS by default, so you don't need to use a specific loader for it.
29+
30+
You can simply add PostCSS plugins you want to use to the `.postcssrc.js`file in your project's root directory:
2931

3032
``` js
31-
// build/webpack.base.conf.js
33+
// https://github.com/michael-ciniawsky/postcss-load-config
34+
3235
module.exports = {
33-
// ...
34-
vue: {
35-
postcss: [/* your plugins */]
36+
"plugins": {
37+
// to edit target browsers: use "browserslist" field in package.json
38+
"postcss-import": {},
39+
"autoprefixer": {}
3640
}
3741
}
3842
```

Diff for: docs/structure.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,25 @@
1818
├── test/
1919
│ └── unit/ # unit tests
2020
│ │ ├── specs/ # test spec files
21-
│ │ ├── setup.js # file that runs before Jest tests
21+
│ │ ├── eslintrc # config file for eslint with extra settings only for unit tests
2222
│ │ ├── index.js # test build entry file
23-
│ │ └── karma.conf.js # test runner config file
23+
│ │ ├── jest.conf.js # Config file when using Jest for unit tests
24+
│ │ └── karma.conf.js # test runner config file when using Karma for unit tests
25+
│ │ ├── setup.js # file that runs before Jest runs your unit tests
2426
│ └── e2e/ # e2e tests
2527
│ │   ├── specs/ # test spec files
2628
│ │   ├── custom-assertions/ # custom assertions for e2e tests
2729
│ │   ├── runner.js # test runner script
2830
│ │   └── nightwatch.conf.js # test runner config file
2931
├── .babelrc # babel config
30-
├── .postcssrc.js # postcss config
32+
├── .editorconfig # indentation, spaces/tabs and similar settings for your editor
3133
├── .eslintrc.js # eslint config
32-
├── .editorconfig # editor config
34+
├── .eslintignore # eslint ignore rules
35+
├── .gitignore # sensible defaults for gitignore
36+
├── .postcssrc.js # postcss config
3337
├── index.html # index.html template
34-
└── package.json # build scripts and dependencies
38+
├── package.json # build scripts and dependencies
39+
└── README.md # Default README file
3540
```
3641

3742
### `build/`

0 commit comments

Comments
 (0)