1.0.2 • Published 8 years ago

postcss-class-whitelist v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

postcss-class-whitelist

Remove any class selector not in a provided whitelist

Usage

Require postcss-class-whitelist, pass it an options object with a classes array and pass the instance into postcss:

postcss(whitelist({classes: ['my', 'allowed', 'classes']})).process(css)

Example

var postcss = require('postcss')
var whitelist = require('postcss-class-whitelist')

var css = `
  .my, .allowed { font-size: 12px; }
  .classes { background: blue; }
  .classes h1 { background: red; }
  .should-disappear { color: blue; }
`

var result = postcss(whitelist({
  classes: ['my', 'allowed', 'classes']
})).process(css)

console.log(result.css)

License

  • MIT

Acknowledgements