@@ -25,10 +25,29 @@ npm install postcss-loader --save-dev
25
25
26
26
## Usage
27
27
28
+ Create ` postcss.config.js ` :
29
+
30
+ ``` js
31
+ module .exports = {
32
+ plugins: [
33
+ require (' postcss-smart-import' )({ /* ...options */ }),
34
+ require (' precss' )({ /* ...options */ }),
35
+ require (' autoprefixer' )({ /* ...options */ })
36
+ ]
37
+ }
38
+ ```
39
+
40
+ You could put different configs in different directories. For example,
41
+ global config in ` project/postcss.config.js ` and override its plugins
42
+ in ` project/src/legacy/postcss.config.js ` .
43
+
44
+ You can read more about common PostCSS config in
45
+ [ postcss-load-config] ( https://github.com/michael-ciniawsky/postcss-load-config ) .
46
+
28
47
Add PostCSS Loader to ` webpack.config.js ` . Put it after ` css-loader `
29
48
and ` style-loader ` . But before ` sass-loader ` , if you use it.
30
49
31
- Webpack 2:
50
+ ### Webpack 2
32
51
33
52
``` js
34
53
module .exports = {
@@ -47,7 +66,7 @@ module.exports = {
47
66
}
48
67
```
49
68
50
- Webpack 1:
69
+ ### Webpack 1
51
70
52
71
``` js
53
72
module .exports = {
@@ -66,26 +85,6 @@ module.exports = {
66
85
}
67
86
```
68
87
69
- Then create ` postcss.config.js ` :
70
-
71
- ``` js
72
- module .exports = {
73
- plugins: [
74
- require (' postcss-smart-import' )({ /* ...options */ }),
75
- require (' precss' )({ /* ...options */ }),
76
- require (' autoprefixer' )({ /* ...options */ })
77
- ]
78
- }
79
- ```
80
-
81
- You could put different configs in different directories. For example,
82
- global config in ` project/postcss.config.js ` and override its plugins
83
- in ` project/src/legacy/postcss.config.js ` .
84
-
85
- You can read more about common PostCSS config in [ postcss-load-config] .
86
-
87
- [ postcss-load-config ] : https://github.com/michael-ciniawsky/postcss-load-config
88
-
89
88
## Options
90
89
91
90
### Plugins
0 commit comments