Skip to content

Latest commit

 

History

History
65 lines (47 loc) · 2.44 KB

README.md

File metadata and controls

65 lines (47 loc) · 2.44 KB

CSSTree logo

CSSTree

NPM version Build Status Coverage Status Join the CSSTree chat at https://gitter.im/csstree/csstree Twitter

Fast detailed CSS parser

Work in progress. Project in alpha stage since AST format is subject to change.

Docs and tools:

Related projects:

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