Package Exports
- postcss-filter-declarations
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-filter-declarations) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
postcss-filter-declarations
PostCSS plugin to filter declarations by property names
var fs = require('fs');
var postcss = require('postcss');
var filterDeclarations = require('postcss-filter-declarations');
postcss()
.use(filterDeclarations({props: ['display', 'color']}))
.process(fs.readFileSync('path/to/css/file'))
.css;.menubar {
display: block;
position: fixed;
color: gray;
}
@media print {
h1 {
font-size: 16px;
}
a {
color: blue;
}
}↓
.menubar {
display: block;
color: gray;
}
@media print {
h1 {
}
a {
color: blue;
}
}Installation
npm install postcss-filter-declarationsAPI
var filterDeclarations = require('postcss-filter-declarations');filterDeclarations([options])
options: Object
Return: Function
options.props
(alias: options.properties)
Type: Stirng or Array of String
Default: []
Removes all CSS declarations except for the proerties specified by this option.
postcss()
.use(filterDeclarations({
pops: 'color'
}))
.process('a {color: red;} b {background: blue;}')
.css; //=> 'a {color: red;} b {}'options.exclude
Type: Boolean
Defult: false
Inverts the filtering result.
postcss()
.use(filterDeclarations({
pops: 'color',
exclude: true
}))
.process('a {color: red;} b {background: blue;}')
.css; //=> 'a {} b {background: blue;}'License
Copyright (c) 2014 Shinnosuke Watanabe
Licensed under the MIT License.