Clean unnecessary CSS with PurifyCSS
npm install postcss-purifycss !node
Clean unnecessary CSS with PurifyCSS
- Easily integrates PurifyCSS with postcss
- Allows you to use any PurifyCSS options
- Ignore a line or whole chunks of code, exactly like with uncss
``css
/ purifycss:ignore /
.selector1 {
/ this rule will be ignored /
}
.selector2 {
/ this will NOT be ignored /
}
/ purifycss:ignore start /
/ all rules in here will be ignored /
/ purifycss:ignore end /
`
_– taken from UnCSS example_
An example of how to use this module:
`js
const purify = require('postcss-purifycss');
postcss([
purify({
content: [],
whitelist: [],
purifyOptions: {
info: false,
rejected: false,
whitelist: [],
}
}),
]);
`
| Option | Required | Description |
| ------------ | :------------: | ----------- |
| content | ✓ | The PurifyCSS content argumentwhitelist
| || A whitelist using Regular ExpressionspurifyOptions` || The optional PurifyCSS options argument
|
Credits to UnCSS (MIT) for the ignoring code and the foundation of a PostCSS plugin.