grunt-focus
Version:
Focus and run a subset of watch targets
31 lines (24 loc) • 776 B
JavaScript
/*
* grunt-focus
* https://github.com/joeytrapp/grunt-focus
*
* Copyright (c) 2013 Joey Trapp
* Licensed under the MIT license.
*/
;
var ObjectFilter = require('../lib/object_filter');
module.exports = function(grunt) {
grunt.registerMultiTask('focus', 'Your task description goes here.', function() {
var watchers = grunt.config.get('watch');
if (typeof watchers !== 'object') {
grunt.fail.warn('watch config must be defined and be an object');
return;
}
var filter = new ObjectFilter(this.data),
options = watchers.options,
filteredWatchers = filter.process(watchers);
filteredWatchers.options = options || {};
grunt.config.set('watch', filteredWatchers);
grunt.task.run(['watch']);
});
};