Open andidev opened 9 years ago
Add file ignored by watch if folder does not already contain a file matching the files pattern when running grunt watch.
grunt watch
Gruntfile.js
/*global module:false*/ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ // Task configuration. jshint: { all: { src: ['src/**/*.js'] } }, watch: { lib_test: { files: 'src/**/*.js', tasks: ['jshint:all'] } } }); // These plugins provide necessary tasks. grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); };
package.json
{ "engines": { "node": ">= 0.10.0" }, "devDependencies": { "grunt": "0.4.5", "grunt-contrib-jshint": "0.10.0", "grunt-contrib-watch": "0.6.1" } }
Using
Reproduced by
git clone https://github.com/andidev/grunt-contrib-watch-add-file-bug-example-project
cd grunt-contrib-watch-add-file-bug-example-project
npm install
jsfile1.js
src
The console output so far:
Running "watch" task Waiting...
i.e. no reaction from the watch task
jsfile2.js
The console output now looks a bit better, grunt watch works!
Running "watch" task Waiting... >> File "src/jsfile2.js" added. Running "jshint:all" (jshint) task >> 2 files lint free. Done, without errors. Completed in 0.579s at Sun May 17 2015 13:13:03 GMT+0200 (CEST) - Waiting...
once again thats great! but wait a minute...
jsfile3.js
The console output now looks a bit sad, grunt watch does not work again.
i.e. no reaction from the watch task since there where no files matching the files pattern when grunt watch was started
This is the same issue described in https://github.com/gruntjs/grunt-contrib-watch/issues/166#issuecomment-21432390
Add file ignored by watch if folder does not already contain a file matching the files pattern when running
grunt watch
.Gruntfile.js
package.json
Using
Reproduced by
git clone https://github.com/andidev/grunt-contrib-watch-add-file-bug-example-project
cd grunt-contrib-watch-add-file-bug-example-project
npm install
grunt watch
jsfile1.js
insrc
folderThe console output so far:
i.e. no reaction from the watch task
grunt watch
jsfile2.js
insrc
folderThe console output now looks a bit better, grunt watch works!
once again thats great! but wait a minute...
jsfile1.js
andjsfile2.js
file from thesrc
folder and then start it again withgrunt watch
jsfile3.js
insrc
folderThe console output now looks a bit sad, grunt watch does not work again.
i.e. no reaction from the watch task since there where no files matching the files pattern when grunt watch was started