All Projects → andreypopp → cssobjectify

andreypopp / cssobjectify

Licence: MIT license
Browserify transform to turn stylesheets into JSON objects

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

cssobjectify

Source transform for browserify or dcompose which converts CSS into JSON objects which can be used further by libraries like React to assign styles to UI components.

styles.css:

MyComponent {
  font-size: 12px;
  background-color: red;
}

myapp.js:

var React = require('react-tools/build/modules/React');
var Styles = require('./styles.css');

var MyComponent = React.createClass({
  render: function() {
    return (
      <div style={Styles.MyComponent}>
        Hello, world!
      </div>
    )
  }
});

Usage

Use npm to install the package:

% npm install cssobjectify

And use it with browserify:

% browserify -t cssobjectify ./myapp.js

where ./myapp.js or its dependencies can reference *.css files by require(...) calls.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].