stomt / gulp-modular

Boilerplate gulp tasks for quick project setup.
MIT License
10 stars 0 forks source link

watch for added and deleted files #35

Open maxklenk opened 9 years ago

maxklenk commented 9 years ago

Subtasks:

maxklenk commented 9 years ago

I "merged" the issues in this one because the global handling will be the same.

I was able to get the watch tasks listening for add/remove events, but only with a big performance losses. My script task took 6 seconds when using browserSync for the watches, it normally takes about 3 seconds.

The code to make it work like this:

    var watchOptions = {
      //persistent: true,

      //ignored: '*.txt',
      ignoreInitial: true,
      //followSymlinks: true,
      //cwd: '.',

      usePolling: true
      //alwaysStat: false,
      //depth: undefined,
      //interval: 100,

      //ignorePermissionErrors: false,
      //atomic: true
    };

    browserSync.watch(config.app.js, watchOptions, function (event, file) {
      gulp.start('scripts')
    });