I got this working while compiling my smaller files. You should be able to adapt a bit to this configuration for git by working with the coffeescript plugin. The part of interest is grunt.event.on('watch', ...) . In this event handler, I update the files property in the less command to only contain the modified file.
path = require('path'); module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), less: { development: { options: { paths: ["./library/less"], }, files: [ { src: "./library/less/bootstrap.less", dest: "./library/css/bootstrap.css"}, { src: "./library/less/app.less", dest: "./library/css/app.css"} ] } }, watch: { styles: { files: "./library/less/*", tasks: ["less"], options: { nospawn: true, }, }, }, }); // Event handling grunt.event.on('watch', function(action, filepath){ // Update the config to only build the changed less file. grunt.config(['less', 'development', 'files'], [ {src: filepath, dest: './library/css/' + path.basename(filepath, '.less') + '.css'} ]); }); // Load the plugins grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-watch'); // Tasks grunt.registerTask('default', ['watch']); };
blachniet Jul 01 '13 at 0:56 2013-07-01 00:56
source share