subtleGradient / Sheet.js

CommonJS & Browser JavaScript for parsing many CSS-like languages. Parse a CSS string into a JS object!
http://subtlegradient.github.com/Sheet.js/Test/
MIT License
61 stars 6 forks source link

Sheet.js by Thomas Aylott of MooTools

STATE: well tested and stable

This project uses semver.org standard version numbering.

Sheet.js

Parse CSS in JavaScript

Flexible Parsing

Coming Soon…

Basic Usage

ClientSide / Browser Usage

var myStyleSheet = new Sheet("#selector { color:blue }");
myStyleSheet.cssRules[0].style.color; // blue
// etc…

ServerSide / CommonJS Usage

require.paths.push('path/to/Sheet.js/Source'); // You might not need this
var Sheet = require('Sheet').Sheet;

var myStyleSheet = new Sheet("#selector { color:blue }");
myStyleSheet.cssRules[0].style.color; // blue
// etc…

Advanced ClientSide Namespacing

If you need to move Sheet.js to its own custom namespace simply define a global exports object before loading Sheet.js. Sheet.js will see that object, assume that it's in a CommonJS environment and then attach itself onto that object instead of including itself globally.

You really shouldn't need to do that. But isn't it great to know you could?