Skip to content

Commit 114db12

Browse files
halfzebramichael-ciniawsky
authored andcommittedAug 4, 2018
docs(README): add autoprefixing example (#380)
1 parent 8772814 commit 114db12

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed
 

‎README.md

+27-4
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ module.exports = ({ file, options, env }) => ({
179179
parser: file.extname === '.sss' ? 'sugarss' : false,
180180
plugins: {
181181
'postcss-import': { root: file.dirname },
182-
'postcss-preset-env': options.presetEnv ? options.presetEnv : false,
182+
'postcss-preset-env': options['postcss-preset-env'] ? options['postcss-preset-env'] : false,
183183
'cssnano': env === 'production' ? options.cssnano : false
184184
}
185185
})
@@ -192,9 +192,8 @@ module.exports = ({ file, options, env }) => ({
192192
options: {
193193
config: {
194194
ctx: {
195-
cssnext: {...options},
195+
'postcss-preset-env': {...options},
196196
cssnano: {...options},
197-
autoprefixer: {...options}
198197
}
199198
}
200199
}
@@ -212,7 +211,6 @@ module.exports = ({ file, options, env }) => ({
212211
plugins: (loader) => [
213212
require('postcss-import')({ root: loader.resourcePath }),
214213
require('postcss-preset-env')(),
215-
require('autoprefixer')(),
216214
require('cssnano')()
217215
]
218216
}
@@ -332,6 +330,31 @@ within the CSS directly as an annotation comment.
332330
}
333331
```
334332

333+
### Autoprefixing
334+
335+
**webpack.config.js**
336+
```js
337+
{
338+
test: /\.css$/,
339+
use: [
340+
'style-loader',
341+
'css-loader',
342+
{
343+
loader: 'postcss-loader',
344+
options: {
345+
ident: 'postcss',
346+
plugins: [
347+
require('autoprefixer')({...options}),
348+
...,
349+
]
350+
}
351+
}
352+
]
353+
}
354+
```
355+
356+
> :warning: [`postcss-preset-env`](https://github.com/csstools/postcss-preset-env) includes [`autoprefixer`](https://github.com/postcss/autoprefixer), so adding it separately is not necessary if you already use the preset.
357+
335358
### `CSS Modules`
336359

337360
This loader [cannot be used] with [CSS Modules] out of the box due

0 commit comments

Comments
 (0)
Please sign in to comment.