Created
February 23, 2014 22:09
-
-
Save georgicodes/9178054 to your computer and use it in GitHub Desktop.
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
| module.exports = function(grunt) { | |
| grunt.initConfig({ | |
| less: { | |
| development: { | |
| options: { | |
| compress: true, | |
| yuicompress: true, | |
| optimization: 2 | |
| }, | |
| files: { | |
| // target.css file: source.less file | |
| "css/styles.css": "less/styles.less" | |
| } | |
| } | |
| }, | |
| watch: { | |
| styles: { | |
| // Which files to watch (all .less files recursively in the less directory) | |
| files: ['myLessDir/less/**/*.less'], | |
| tasks: ['less'], | |
| options: { | |
| nospawn: true | |
| } | |
| } | |
| } | |
| }); | |
| grunt.loadNpmTasks('grunt-contrib-less'); | |
| grunt.loadNpmTasks('grunt-contrib-watch'); | |
| grunt.registerTask('default', ['watch']); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a Gruntfile.js example for LESS. It watches a directory and compiles the LESS file into a CSS file. Remember to first add devDependencies to package.json, then npm install. You can just run grunt and it will watch an compile
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-less": "~0.5.0",
"grunt-contrib-watch": "~0.4.0"
},