Add a watch task to recompile assets on change

This commit is contained in:
Rowan Manning
2013-11-05 11:34:27 +00:00
parent 6b0cf20e4e
commit 46d9f2ade8
3 changed files with 10 additions and 0 deletions

View File

@@ -27,12 +27,20 @@ module.exports = function (grunt) {
'public/css/main.css': 'public/less/main.less' 'public/css/main.css': 'public/less/main.less'
} }
} }
},
watch: {
less: {
files: ['public/less/**/*.less'],
tasks: ['less']
}
} }
}); });
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('lint', ['jshint']); grunt.registerTask('lint', ['jshint']);
grunt.registerTask('compile', ['less']); grunt.registerTask('compile', ['less']);

View File

@@ -60,6 +60,7 @@ Now you'll be able to run the following commands:
$ grunt # Run the lint and test tasks together $ grunt # Run the lint and test tasks together
$ grunt lint # Run JSHint with the correct config $ grunt lint # Run JSHint with the correct config
$ grunt compile # Compile front-end assets $ grunt compile # Compile front-end assets
$ grunt watch # Watch for file changes and compile assets
``` ```
Code with lint errors or failing tests will not be accepted, please use the build tools outlined above. Code with lint errors or failing tests will not be accepted, please use the build tools outlined above.

View File

@@ -34,6 +34,7 @@
"grunt": "~0.4", "grunt": "~0.4",
"grunt-contrib-jshint": "~0.7", "grunt-contrib-jshint": "~0.7",
"grunt-contrib-less": "~0.8", "grunt-contrib-less": "~0.8",
"grunt-contrib-watch": "~0.5",
"supervisor": "~0.5" "supervisor": "~0.5"
}, },