简体   繁体   中英

Gulp watch path excluding directory

I have a Gulp watch task pointing at my SCSS files like so:

gulp.task('watch', () => {
  watch('assets/scss/**/*.scss', () => {
    gulp.start('css-development');
  });
});

My text editor Coda saves to a temporary buffer file such as (A Document Being Saved By Coda)/styles.scss . My watch task sees that file and tries to execute, so I need to get it to ignore any instance of that folder. What should my new watch path look like?

I image it would be something like this, although this is obviously wrong.

watch('assets/scss/**{!(A Document Being Saved By Coda)}/*.scss'

If I understood that question right you want to ignore a specific file? If so this should work, just like in gulp.src:

gulp.watch('assets/scss/*.scss', ['!assets/scss/YourFile.scss']);

A quick response if it worked would be good, same if it not worked so we can figure out a better solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM