Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browserify transform to turn stylesheets into JSON objects
JavaScript CSS
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
specs
.gitignore
.jshintrc
LICENSE
Makefile
README.md
index.js
package.json

README.md

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.

Something went wrong with that request. Please try again.