Created
April 23, 2016 18:18
-
-
Save chrisvasey/914d61f3a1e50000895ca8cf3867abf4 to your computer and use it in GitHub Desktop.
Compiling LESS on save with Grunt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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