Skip to content

Commit c14d036

Browse files
committed
add docs for babel and postcss
1 parent 96f1167 commit c14d036

File tree

5 files changed

+63
-26
lines changed

5 files changed

+63
-26
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ If you have been suffering from configuration hell, give [vbuild](https://github
99

1010
## Features
1111

12-
- Vue 2
13-
- Latest version of Vuex/Router
14-
- Webpack 2
15-
- Babel 6
16-
- Hot reloading
12+
- Vue 2 / Vue-router / Vuex
13+
- Hot reloading for single-file components
1714
- Split vendor code from your app
15+
- Webpack 2
16+
- [Babel 6](/docs/babel.md)
17+
- [PostCSS](/docs/postcss.md)
1818
- [JSX components are supported by default](/docs/jsx.md)
1919
- [Electron support](/docs/electron.md) (optional)
2020
- [CSS modules](/docs/css-modules.md) (optional)

docs/babel.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Babel
2+
3+
This default settings for `babel-loader` in Vuepack:
4+
5+
```js
6+
{
7+
babelrc: false,
8+
presets: [
9+
['es2015', {modules: false}],
10+
'stage-1'
11+
],
12+
plugins: [
13+
'transform-vue-jsx'
14+
]
15+
}
16+
```
17+
18+
Which means you can use all ES2015 and ESnext stage-1 features, and Vue JSX support.
19+
20+
You can update it in `./build/config.js`.

docs/postcss.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# PostCSS
2+
3+
This default settings for `postcss-loader` in Vuepack:
4+
5+
```js
6+
[
7+
require('autoprefixer')({
8+
// Vue does not support ie 8 and below
9+
browsers: ['last 2 versions', 'ie > 8']
10+
}),
11+
require('postcss-nested')
12+
]
13+
```
14+
15+
You can update it in `./build/config.js`.

template/build/config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,29 @@
22

33
module.exports = {
44
port: 4000,
5+
title: '{{name}}',
56
vendor: [
67
'vue',
78
'vue-router',
89
'vuex'
910
],
11+
babel: {
12+
babelrc: false,
13+
presets: [
14+
['es2015', {modules: false}],
15+
'stage-1'
16+
],
17+
plugins: [
18+
'transform-vue-jsx'
19+
]
20+
},
21+
postcss: [
22+
require('autoprefixer')({
23+
// Vue does not support ie 8 and below
24+
browsers: ['last 2 versions', 'ie > 8']
25+
}),
26+
require('postcss-nested')
27+
],
1028
cssModules: true,{{#if electron}}
1129
electron: true,{{/if}}{{#if jsx}}
1230
jsx: true{{/if}}

template/build/webpack.base.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22
const path = require('path')
33
const webpack = require('webpack')
44
const HtmlWebpackPlugin = require('html-webpack-plugin')
5-
6-
const postcss = [
7-
require('autoprefixer')({
8-
// Vue does not support ie 8 and below
9-
browsers: ['last 2 versions', 'ie > 8']
10-
}),
11-
require('postcss-nested')
12-
]
5+
const config = require('./config')
136

147
module.exports = {
158
entry: {
@@ -44,24 +37,15 @@ module.exports = {
4437
}
4538
]
4639
},
47-
babel: {
48-
babelrc: false,
49-
presets: [
50-
['es2015', {modules: false}],
51-
'stage-1'
52-
],
53-
plugins: [
54-
'transform-vue-jsx'
55-
]
56-
},
57-
postcss,
40+
babel: config.babel,
41+
postcss: config.postcss,
5842
vue: {
5943
loaders: {},
60-
postcss
44+
postcss: config.postcss
6145
},
6246
plugins: [
6347
new HtmlWebpackPlugin({
64-
title: '{{name}}',
48+
title: config.title,
6549
template: __dirname + '/index.html',
6650
filename: '../index.html'
6751
})

0 commit comments

Comments
 (0)