css-treeify
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

CSS Treeify Travis CI Build Status

Parse the structure of CSS to an object tree.

NPM Badge

Install

npm install css-treeify

Usage

const cssTreeify = require("css-treeify");
 
cssTreeify(`
body { font-size: 10px; }
html { font-size: 11px; }
html, body { font-size: 12px; }
@media only screen and (max-width: 600px) {
  body {
    background-color: lightblue;
  }
  html {
      background-color: grey;
  }
}
`);
/* {
    '@media only screen and (max-width: 600px)': {
        body: {
            'background-color': 'lightblue'
        },
        html: {
            'background-color': 'grey'
        }
    },
    body: {
        'font-size': '12px'
    },
    html: {
        'font-size': '12px'
    }
}
*/

API

cssTreeify(css)

css

Type: string

The CSS to parse.

Package Sidebar

Install

npm i css-treeify

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

4.68 kB

Total Files

6

Last publish

Collaborators

  • richienb