Every `gulp.watch` listener fires on every file change
Created by: lynndylanhurley
For example, when I save a coffeescript file, it triggers all of the tasks for all of the other watchers. Same with any other type of file. Any change will trigger all of the watchers.
The watch code is here:
// Watch for changes in .tmp folder, reload the browser
gulp.watch([
'.tmp/*.html',
'.tmp/styles/**/*.css',
'.tmp/scripts/**/*.js',
'.tmp/images/**/*.*'
], function(event) {
console.log('@-->caught change in file', event);
gulp.src(event.path, {read: false})
.pipe($.livereload(lr));
});
// Watch .scss files
gulp.watch('app/styles/**/*.scss', ['sass']);
// Watch .styl files
gulp.watch('./app/styles/**/*.styl', ['stylus']);
// Watch sprites
gulp.watch('app/images/sprites/**/*.png', ['sprites']);
// Watch .js files
gulp.watch('app/scripts/**/*.js', ['js']);
// Watch .coffee files
gulp.watch('./app/scripts/**/*.coffee', ['coffee']);
// Watch .jade files
gulp.watch('app/index.jade', ['base-tmpl']);
gulp.watch('app/views/**/*.jade', ['reload-js-tmpl']);
// Watch image files
gulp.watch('app/images/**/*', ['images']);
// Watch bower files
gulp.watch('app/bower_components/*', ['bowerjs', 'bowercss']);
I just started experiencing this problem with a yeoman generator that I built.
The strange thing is that older projects built using this generator do not exhibit this behavior.
I tried updating all of the dependencies to the most recent versions, but it did not solve the issue.
The generator is here: https://github.com/lynndylanhurley/generator-gulp-of-drano