Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nv/jscssp

CommonJS module of JavaScript CSS Parser written by Daniel Glazman
https://github.com/nv/jscssp

Last synced: about 2 months ago
JSON representation

CommonJS module of JavaScript CSS Parser written by Daniel Glazman

Awesome Lists containing this project

README

        

# [JavaScript CSS Parser](http://glazman.org/JSCSSP/)

## 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

## Analogs

* [CSSOM.js](http://github.com/NV/CSSOM)
* [Sheet.js](http://github.com/subtleGradient/Sheet.js)
* [CodeMirror's CSS parser](http://codemirror.net/csstest.html)