LESS to JS
Turn less files into browser and node.js compatable js.
How it Works
app.js
require('./hello.less.js');
hello.less
.hello{
.world {
color: lighten(red, 20%);
}
}
Then compile the less to js
$ grunt less_to_js
which then creates hello.less.js
if(typeof document!=='undefined')require('insert-css')(".hello .world{color:#f66}")
Installation
$ npm install grunt-less-to-js --save-dev
$ npm install insert-css --save
Gruntfile.js
module.exports = function(grunt){
grunt.initConfig({
less_to_js: {
files: ['src/**/*.less', 'src/**/*.css']
}
});
grunt.loadNpmTasks('grunt-less-to-js');
};
License
MIT