Skip to content

Commit 526df91

Browse files
committed
Fix docs sections
1 parent 64b370a commit 526df91

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,29 @@ npm install postcss-loader --save-dev
2525

2626
## Usage
2727

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+
2847
Add PostCSS Loader to `webpack.config.js`. Put it after `css-loader`
2948
and `style-loader`. But before `sass-loader`, if you use it.
3049

31-
Webpack 2:
50+
### Webpack 2
3251

3352
```js
3453
module.exports = {
@@ -47,7 +66,7 @@ module.exports = {
4766
}
4867
```
4968

50-
Webpack 1:
69+
### Webpack 1
5170

5271
```js
5372
module.exports = {
@@ -66,26 +85,6 @@ module.exports = {
6685
}
6786
```
6887

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-
8988
## Options
9089

9190
### Plugins

0 commit comments

Comments
 (0)