Fix for watch configs with "default" target name. Fixes GH-312.

pull/318/head
Kyle Robinson Young 11 years ago
parent 95e415db71
commit c92448d418

@ -20,6 +20,7 @@ module.exports = function(grunt) {
function TaskRun(target) {
this.name = target.name || 0;
this.files = target.files || [];
this._getConfig = target._getConfig;
this.options = target.options;
this.startedAt = false;
this.spawned = null;
@ -49,13 +50,13 @@ module.exports = function(grunt) {
// Start this task run
self.startedAt = Date.now();
//reset before each run
// reset before each run
self.spawnTaskFailure = false;
self.errorsAndWarningsCount = getErrorCount();
//pull the tasks here in case they were changed by a watch event listener
self.tasks = grunt.config('watch' + (this.name === 'default' ? '' : '.' + this.name) + '.tasks') || [];
if (typeof this.tasks === 'string') {
// pull the tasks here in case they were changed by a watch event listener
self.tasks = self._getConfig('tasks') || [];
if (typeof self.tasks === 'string') {
self.tasks = [self.tasks];
}

@ -218,7 +218,15 @@ module.exports = function(grunt) {
// Push targets onto the queue
Runner.prototype.add = function add(target) {
var self = this;
if (!this.targets[target.name || 0]) {
// Private method for getting latest config for a watch target
target._getConfig = function(name) {
return grunt.config([self.name, target.name, name || '']);
};
// Create a new TaskRun instance
var tr = new TaskRun(target);
// Add livereload to task runs

Loading…
Cancel
Save