Package Exports
- css-tree
- css-tree/data
- css-tree/data/patch.json
- css-tree/dist/csstree
- css-tree/dist/default-syntax.json
- css-tree/lib/utils/list
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 (css-tree) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CSSTree
Fast detailed CSS parser
Work in progress. Project in alpha stage since AST format is subject to change.
- Parsing CSS into AST
- AST format
- Translate AST to string
- AST traversal
- Utils to work with AST
- Working with syntax
- API references:
Docs and tools:
- AST Explorer – explore CSSTree AST format with zero setup
- CSS syntax reference
- CSS syntax validator
Related projects:
- csstree-validator – NPM package to validate CSS
- stylelint-csstree-validator – plugin for stylelint to validate CSS
- Grunt plugin
- Gulp plugin
- Sublime plugin
- VS Code plugin
- Atom plugin
Install
> npm install css-tree
Usage
var csstree = require('css-tree');
var ast = csstree.parse('.example { world: "!" }');
csstree.walk(ast, function(node) {
if (node.type === 'ClassSelector' && node.name === 'example') {
node.name = 'hello';
}
});
console.log(csstree.translate(ast));
// .hello{world:"!"}
License
MIT
Syntax matching use mdn/data by Mozilla Contributors