Skip to content

Commit 4c31cab

Browse files
committed
Docs: Better migration guide for postcss-cssnext with custom plugins and cssnano included
poke @magsout
1 parent c83d39a commit 4c31cab

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

docs/content/postcss.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ If you were using cssnext with default options, you might just need this:
6161

6262
```console
6363
$ npm uninstall cssnext [--save[-dev]]
64-
$ npm install postcss postcss-import postcss-url postcss-reporter postcss-browser-reporter postcss-cssnext [--save[-dev]]
64+
$ npm install postcss postcss-import postcss-url postcss-cssnext postcss-browser-reporter postcss-reporter [--save[-dev]]
6565
```
6666

6767
With the previous lines you might thing that you are going backward by having a
@@ -73,15 +73,23 @@ and previous default cssnext behavior.
7373

7474
##### [postcss-cli](https://www.npmjs.com/package/postcss-cli)
7575

76+
```console
77+
$ npm install postcss-cli --save-dev
78+
```
79+
7680
Here is an example of the json config you might use with something like
7781
``$ postcss-cli -c postcss.config.json``.
7882

79-
```json
83+
```js
8084
{
8185
"use": [
8286
"postcss-import",
8387
"postcss-url",
84-
"postcss-cssnext"
88+
"postcss-cssnext",
89+
// add your "plugins" here
90+
// ...
91+
// and if you want to compress
92+
// "cssnano",
8593
"postcss-browser-reporter",
8694
"postcss-reporter",
8795
]
@@ -90,6 +98,11 @@ Here is an example of the json config you might use with something like
9098

9199
##### [grunt-postcss](https://www.npmjs.com/package/grunt-postcss)
92100

101+
```console
102+
$ npm uninstall grunt-cssnext --save-dev
103+
$ npm install grunt-postcss --save-dev
104+
```
105+
93106
```js
94107
grunt.initConfig({
95108
postcss: {
@@ -98,6 +111,10 @@ grunt.initConfig({
98111
require("postcss-import")(),
99112
require("postcss-url")(),
100113
require("postcss-cssnext")(),
114+
// add your "plugins" here
115+
// ...
116+
// and if you want to compress
117+
// require("cssnano")(),
101118
require("postcss-browser-reporter")(),
102119
require("postcss-reporter")(),
103120
]
@@ -111,6 +128,11 @@ grunt.initConfig({
111128

112129
##### [gulp-postcss](https://www.npmjs.com/package/gulp-postcss)
113130

131+
```console
132+
$ npm uninstall gulp-cssnext --save-dev
133+
$ npm install gulp-postcss --save-dev
134+
```
135+
114136
```js
115137
var gulp = require('gulp')
116138
var postcss = require('gulp-postcss')
@@ -122,6 +144,10 @@ gulp.task('css', function () {
122144
require("postcss-import")(),
123145
require("postcss-url")(),
124146
require("postcss-cssnext")(),
147+
// add your "plugins" here
148+
// ...
149+
// and if you want to compress
150+
// require("cssnano")(),
125151
require("postcss-browser-reporter")(),
126152
require("postcss-reporter")(),
127153
]))
@@ -132,6 +158,11 @@ gulp.task('css', function () {
132158

133159
##### [postcss-loader](https://www.npmjs.com/package/postcss-loader)
134160

161+
```console
162+
$ npm uninstall cssnext-loader --save-dev
163+
$ npm install postcss-loader --save-dev
164+
```
165+
135166
```js
136167
module.exports = {
137168
module: {
@@ -147,6 +178,10 @@ module.exports = {
147178
require("postcss-import")({ addDependencyTo: webpack }),
148179
require("postcss-url")(),
149180
require("postcss-cssnext")(),
181+
// add your "plugins" here
182+
// ...
183+
// and if you want to compress,
184+
// just use css-loader option that already use cssnano under the hood
150185
require("postcss-browser-reporter")(),
151186
require("postcss-reporter")(),
152187
]

0 commit comments

Comments
 (0)