From 4d76707d27723cc270566df4a701646bd4f7519e Mon Sep 17 00:00:00 2001 From: Kyle Robinson Young Date: Mon, 19 Nov 2012 12:45:45 -0800 Subject: [PATCH] Allow watch task to be renamed. Closes GH-16. --- tasks/watch.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tasks/watch.js b/tasks/watch.js index 87a34b8..3b8d773 100644 --- a/tasks/watch.js +++ b/tasks/watch.js @@ -26,15 +26,16 @@ module.exports = function(grunt) { }; grunt.registerTask('watch', 'Run predefined tasks whenever watched files change.', function(target) { - this.requiresConfig('watch'); + var name = this.name || 'watch'; + this.requiresConfig(name); // Build an array of files/tasks objects - var watch = grunt.config('watch'); + var watch = grunt.config(name); var targets = target ? [target] : Object.keys(watch).filter(function(key) { return typeof watch[key] !== 'string' && !Array.isArray(watch[key]); }); targets = targets.map(function(target) { // Fail if any required config properties have been omitted - target = ['watch', target]; + target = [name, target]; this.requiresConfig(target.concat('files'), target.concat('tasks')); return grunt.config(target); }, this);