var proc = require('child_process'); config.init({ lint: { files : [ 'hoge.js', 'fuga.js' ] }, concat: { 'all.js' : [ 'hoge.js', 'fuga.js', 'cofall.js', '_coftemp.js' ] }, watch: { files: [ 'hoge.js', 'fuga.js', 'cof1.coffee', 'cof2.coffee' ], tasks: 'coffee concat min notifyOK' }, min: { 'all.min.js': [ 'all.js' ] }, coffee: { '_coftemp.js': [ 'cof1.coffee', 'cof2.coffee' ] } }); function notifyError(err, sout, serr, done){ proc.exec("growlnotify -t 'COFFEE COMPILE ERROR!' -m '" + serr + "'"); done(false); } function notifyOK(){ proc.exec("growlnotify -t 'grunt.js' -m '\(^o^)/'"); } task.registerBasicTask('coffee', 'compile CoffeeScripts', function(data, name) { var done = this.async(); var command = 'coffee -j ' + name + ' -c ' + data.join(' '); var out = proc.exec(command, function(err, sout, serr){ if(err || sout || serr){ notifyError(err, sout, serr, done); }else{ done(); } }); }); task.registerTask('notifyOK', 'done!', function(){ notifyOK(); }); task.registerTask('default', 'coffee concat notifyOK');