gulpjs / gulp

A toolkit to automate & enhance your workflow
https://gulpjs.com
MIT License
33.01k stars 4.23k forks source link

gulp.watch ignore/exclude specific folder (node_modules) #1774

Closed Bram-Zijp closed 8 years ago

Bram-Zijp commented 8 years ago

Hi,

I am using gulp.watch and i would like to ignore a folder (node_modules for instance). I would like to use: gulp.watch(['../**/*.php', '!./node_modules/**'], reload);

My gulp file is based on Web Starter Kit from Google and this is my serve task with the bloated manual gulp.watch:

// Watch files for changes & reload
gulp.task('serve', ['scripts', 'styles'], () => {
  browserSync.init({
    notify: false,
    // Customize the Browsersync console logging prefix
    logPrefix: 'WSK',
    scrollElementMapping: ['#page'],
    proxy: project,
    port: 3000
  });

  gulp.watch(['../inc/**/*.php', '../*.php', '../layouts/**/*.php', '../plugins/**/*.php', '../template-parts/**/*.php'], reload);
  gulp.watch(['styles/**/*.{scss,css}'], ['styles', reload]);
  gulp.watch(['scripts/**/*.js'], ['scripts', reload]);
  gulp.watch(['images/**/*'], ['images', reload]);
});
phated commented 8 years ago

Support questions should be directed to StackOverflow.