css-tree
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/css-tree package

1.0.0-alpha18 • Public • Published

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

Package Sidebar

Install

npm i css-tree@1.0.0-alpha18

Version

1.0.0-alpha18

License

MIT

Last publish

Collaborators

  • lahmatiy
  • smelukov