I have a gulp-watch script that watches for changes in my image directory then process the images. The problem is that photoshop save for web is putting temp files in the directory and then renaming them very quickly, which trips up my image processing script. I would like to exclude them from the watch script.
The temp files are formatted as so moog-mftrem_tmp489245944
I would like to use the _tmp
string to exclude, but not sure how to exclude characters in the middle of a file name. Here is what I have tried but doesn’t seem to work:
gulp.task('watch', function() {
gulp.watch(['app/images/pedals/*.png','!app/images/pedals/*_tmp*'], ['images']);
});
Thanks for any help!
2
Answers
While your temp files don’t have extensions, glob paths don’t know what to do if you don’t specify one. It becomes merely a path to a folder, and indeed it doesn’t find a folder name matching your glob.
Try:
Note the extra: .* (period asterisk)
For completeness I like to add the recursive globstar /**/
i.e.
consider using ‘gulp-filter’ :