Skip to content

Commit 4d97805

Browse files
committed
Update docs
1 parent 70f4310 commit 4d97805

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
1111
</a>
1212

13-
[PostCSS plugins]: https://github.com/postcss/postcss#built-with-postcss
13+
[PostCSS plugins]: https://github.com/postcss/postcss#plugins
1414
[PostCSS]: https://github.com/postcss/postcss
1515
[webpack]: http://webpack.github.io/
1616
[ci-img]: https://travis-ci.org/postcss/postcss-loader.svg
@@ -21,8 +21,8 @@
2121
Set `postcss` section in webpack config:
2222

2323
```js
24-
var autoprefixer = require('autoprefixer-core');
25-
var csswring = require('csswring');
24+
var autoprefixer = require('autoprefixer');
25+
var cssnext = require('cssnext');
2626

2727
module.exports = {
2828
module: {
@@ -34,7 +34,7 @@ module.exports = {
3434
]
3535
},
3636
postcss: function () {
37-
return [autoprefixer, csswring];
37+
return [autoprefixer, cssnext];
3838
}
3939
}
4040
```
@@ -52,7 +52,7 @@ Note that the context of this function
5252
module.exports = {
5353
...
5454
postcss: function () {
55-
return [autoprefixer, csswring];
55+
return [autoprefixer, cssnext];
5656
}
5757
}
5858
```
@@ -83,7 +83,7 @@ module.exports = {
8383
},
8484
postcss: function () {
8585
return {
86-
defaults: [autoprefixer, csswring],
86+
defaults: [autoprefixer, cssnext],
8787
cleaner: [autoprefixer({ browsers: [] })]
8888
};
8989
}
@@ -136,11 +136,19 @@ module.exports = {
136136
[postcss-import]: https://github.com/postcss/postcss-import
137137
[onImport]: https://github.com/postcss/postcss-import#onimport
138138

139-
## Safe Mode
139+
## Custom Syntaxes
140+
141+
PostCSS can transforms styles in any syntax, not only in CSS.
142+
There are 3 parameters to control syntax:
140143

141-
If you add `?safe=1` to requirement, PostCSS will try to correct any syntax
142-
error that it finds in the CSS. For example, it will parse `a {` as `a {}`.
144+
* `syntax` accepts module name with `parse` and `stringify` function.
145+
* `parser` accepts module name with input parser function.
146+
* `stringifier` accepts module name with output stringifier function.
147+
148+
For example, you can use [Safe Parser] to find and fix any CSS errors:
143149

144150
```js
145-
var css = require('postcss?safe=1!./broken')
151+
var css = require('postcss?parser=postcss-safe-parser!./broken')
146152
```
153+
154+
[Safe Parser]: https://github.com/postcss/postcss-safe-parser

0 commit comments

Comments
 (0)