Skip to content
This repository has been archived by the owner on Sep 3, 2019. It is now read-only.
/ lessobjectify Public archive

Browserify/dcompose transform to turn LESS into JSON objects

License

Notifications You must be signed in to change notification settings

artps/lessobjectify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lessobjectify

The fork of cssobjectify by Andrey Popp. Source transform for browserify or dcompose which converts LESS into JSON objects which can be used further by libraries like React to assign styles to UI components.

styles.less:

.block {
  font-size: 12px;
  background-color: red;

  &__element {
    &--modifier {
      background-color: blue;
    }
  }
}

myapp.js:

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

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

Usage

Use npm to install the package:

% npm install lessobjectify

And use it with browserify:

% browserify -t lessobjectify ./myapp.js

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

About

Browserify/dcompose transform to turn LESS into JSON objects

Resources

License

Stars

Watchers

Forks

Packages

No packages published