postcss-class-whitelist

1.0.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i postcss-class-whitelist

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • davidmarkclements