Skip to content

Instantly share code, notes, and snippets.

@chrisvasey
Created April 23, 2016 18:18
Show Gist options
  • Save chrisvasey/914d61f3a1e50000895ca8cf3867abf4 to your computer and use it in GitHub Desktop.
Save chrisvasey/914d61f3a1e50000895ca8cf3867abf4 to your computer and use it in GitHub Desktop.
Compiling LESS on save with Grunt
/*
npm install -g grunt-cli
npm init
npm install grunt grunt-contrib-less grunt-contrib-watch jit-grunt --save-dev
grunt
*/
module.exports = function(grunt) {
require('jit-grunt')(grunt);
grunt.initConfig({
less: {
development: {
options: {
compress: true,
yuicompress: true,
optimization: 2
},
files: {
"assets/css/main.css": "assets/css/main.less" // destination file and source file
}
}
},
watch: {
styles: {
files: ['assets/css/**/*.less'], // which files to watch
tasks: ['less'],
options: {
nospawn: true
}
}
}
});
grunt.registerTask('default', ['less', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment