Skip to content

Commit

Permalink
Use grunt.file.isMatch to determine if target tasks should run
Browse files Browse the repository at this point in the history
  • Loading branch information
szurcher committed Sep 7, 2016
1 parent 658ee92 commit 2a73960
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tasks/simple_watch.js
Expand Up @@ -97,13 +97,10 @@ module.exports = function(grunt) {
// For each specified target, test to see if any files matching that
// target's file patterns were modified.
targets.forEach(function(target) {
var files = grunt.file.expand(target.files);
var intersection = grunt.util._.intersection(fileArray, files);
var difference = grunt.util._.difference(fileArray, files);
// Enqueue specified tasks if a matching file was found.
if ( (intersection.length > 0 || difference.length > 0) && target.tasks) {
if( grunt.file.isMatch(target.files, fileArray) && target.tasks ) {
grunt.task.run(target.tasks).mark();
}
}
});
// Enqueue the watch task, so that it loops.
grunt.task.run(nameArgs);
Expand Down

0 comments on commit 2a73960

Please sign in to comment.