0

Lets say I have gulp watch running and I add a file to a task. Is there any way to have the gulp watch process automatically restart since a task has changes?

ryanzec
  • 27,284
  • 38
  • 112
  • 169

1 Answers1

2

gulp.watch isn't working for new or deleted files.

In order to accomplish that, you can use gulp-watch plugin: https://www.npmjs.org/package/gulp-watch

var gulp = require('gulp'),
    watch = require('gulp-watch');

gulp.task('live', function () {
    watch({glob: 'global/files/**/*.extension'}, function(files) {
      // Do stuffs
    });
});

This solution comes from this question:

Gulps gulp.watch not triggered for new or deleted files?

Community
  • 1
  • 1
avcajaraville
  • 9,041
  • 2
  • 28
  • 37