Skip to content

Instantly share code, notes, and snippets.

@gnrlbzik
Forked from shama/switchtask.js
Created August 1, 2013 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnrlbzik/6128729 to your computer and use it in GitHub Desktop.
Save gnrlbzik/6128729 to your computer and use it in GitHub Desktop.
// Run with: grunt switchwatch:target1:target2 to only watch those targets
grunt.registerTask('switchwatch', function() {
var targets = Array.prototype.slice.call(arguments, 0);
Object.keys(grunt.config('watch')).filter(function(target) {
return !(grunt.util._.indexOf(targets, target) !== -1);
}).forEach(function(target) {
grunt.log.writeln('Ignoring ' + target + '...');
grunt.config(['watch', target], {files: []});
});
grunt.task.run('watch');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment