Add grunt watcher on the .less files

This commit is contained in:
Remi Marenco
2016-04-29 12:55:56 -04:00
parent 9242847a4f
commit 9ee0ee5e94
+16 -1
View File
@@ -75,15 +75,30 @@ module.exports = function( grunt ){
]
});
// -------------------------------------------------------------------------- watch & rebuild less files
// use 'grunt watch-style' (from a new tab in your terminal) to have grunt re-copy changed files automatically
grunt.config( 'watch', {
watch: {
// watch for changes in the src dir
files: [ lessPath + '/**' ],
tasks: ['check-modules', 'sprite', 'less-site-config', 'less', 'clean'],
options: {
spawn: false
}
}
});
grunt.loadNpmTasks( 'grunt-contrib-less' );
grunt.loadNpmTasks( 'grunt-spritesmith' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
// Write theme variable for less
grunt.registerTask( 'less-site-config', 'Write site configuration for less', function() {
grunt.file.write( fmt( '%s/tmp-site-config.less', lessPath ), fmt( "@theme-name: %s;", theme ) );
});
grunt.registerTask( 'watch-style', [ 'watch' ] );
grunt.registerTask( 'style', [ 'check-modules', 'sprite', 'less-site-config', 'less', 'clean' ] );
};