JavaScript CSS Parser
Usage
var CSSParser = require("jscssp").CSSParser; var cssParser = new CSSParser; cssParser.parse("h1 {color: red}") -> {cssRules: [{type: 1 , parsedCssText: 'h1 {\n color: red;\n}' , declarations: {type: 1000 , property: 'color' , values: [{value: 'red' , type: 1 , name: null , parentRule: null , parentStyleSheet: [Circular] } ] , valueText: 'red' , priority: false , parsedCssText: 'color: red;' , parentStyleSheet: null , parentRule: null } , mSelectorText: 'h1' , parentStyleSheet: [Circular] , parentRule: null , currentLine: 0 } ] , variables: {} }
Installation (for Node.js)
$ npm install jscssp
Tests
git submodule update --init
open test/index.html
To see test results in the console run
node test/*_test.js