0

I've got a task:

gulp.task('assetsInject', function () {
    gulp.src(paths.index)
        .pipe(plugins.inject(
            gulp.src(paths.scripts, {read: false}),
            {
               addRootSlash: false
            }
        ))
        .pipe(gulp.dest(paths.static))
});

and want it to run on new *.js files created or deleted:

gulp.task('watch', function () {
    plugins.watch({glob: path.scripts}, function () {
        gulp.start('assetsInject')
    });
});

but gulp-watch starts task only when existing files were modified, not when new files were created.

Is it possible to start task after creation and deletion only, not when files were modified?

konclave
  • 648
  • 1
  • 7
  • 19
  • path.scripts = ['static/scripts/**/*.js']; – konclave Jun 20 '14 at 08:27
  • have you tried gulp's native watch instead of the gulp-watch plugin? This seems much more complex than it needs to be, you might not need any plugins to solve this. – joemaller Jul 05 '14 at 19:48

1 Answers1

0

Look at this similar question, it can be that path.scripts contains wrong globs.

Community
  • 1
  • 1
floatdrop
  • 615
  • 5
  • 13