Created
August 1, 2013 05:55
-
-
Save shama/6128718 to your computer and use it in GitHub Desktop.
Grunt task to run multiple watch targets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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