reap-css
v0.3.0
Published
CSS AST traversal filters
Downloads
2
Maintainers
Readme
reap-css
CSS AST traversal filters designed for CSS parsed by read-css
or css.parse
install
npm install reap-css
usage
const reap = require('reap-css')
const read = require('read-css')
const tree = read("test.css")
const harvest = reap(tree)
harvest.selectors() // [".apple", ".orange", "button:enabled", ".flex\\@portrait"]
harvest.properties() // ["color", "border-radius", "color", "cursor", "display"]
harvest.media() // ["(color), (update)", "(orientation: portrait)"]
methods
.selectors()
Collect array of selectors.
reap(tree).selectors()
.properties()
Collect array of properties.
reap(tree).properties()
.media()
Collect array of media queries.
reap(tree).media()
.collect(key)
Collect array of values.
reap(tree).collect("selectors")
.having(key)
Get array of AST nodes having the specified key
reap(tree).having("media")
.type(type)
Get array of AST nodes with the specified type.
reap(tree).type("rule")
traversal
Reap uses traverse to travese the AST. The traversal instance for the current tree is accessible via .traversal
reap(tree).traversal
develop
npm install
npm test
npm run demo