Browserify/dcompose transform to convert CSS into an JSON object

npm install cssobjectify
8 downloads in the last week
9 downloads in the last month


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.


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


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!


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.

npm loves you