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

前端 未结 7 979

The following Gulpjs task works fine when editing files in the glob match:

// watch task.
gulp.task(\'watch\', [\'build\'], function () {
    gulp.watch(src          


        
7条回答
  •  [愿得一人]
    2020-11-27 11:18

    Both gulp.watch() and require('gulp-watch')() will trigger for new/deleted files however not if you use absolute directories. In my tests I did not use "./" for relative directories BTW.

    Both won't trigger if whole directories are deleted though.

       var watch = require('gulp-watch');
       //Wont work for new files until gaze is fixed if using absolute dirs. It  won't trigger if whole directories are deleted though.
       //gulp.watch(config.localDeploy.path + '/reports/**/*', function (event) {
    
       //gulp.watch('src/app1/reports/**/*', function (event) {
       // console.log('*************************** Event received in gulp.watch');
       // console.log(event);
       // gulp.start('localDeployApp');
       });
    
       //Won't work for new files until gaze is fixed if using absolute dirs. It  won't trigger if whole directories are deleted though. See https://github.com/floatdrop/gulp-watch/issues/104
       //watch(config.localDeploy.path + '/reports/**/*', function() {
    
       watch('src/krfs-app/reports/**/*', function(event) {
          console.log("watch triggered");
          console.log(event);
          gulp.start('localDeployApp');
       //});
    

提交回复
热议问题