When setting up a watch on a network drive, I am unable to use ** to find all subdirectories. The error I get has been reported and as far as I can tell it's a known issue with Gulp that isn't yet fixed. The code I'm using is very basic and is just intended to test that a watch is working:
gulp.task('watch', function(){
var watcher = gulp.watch('**/*.js');
watcher.on('change', function(event){
console.log('File: ' + event.path + ' changed');
});
});
My question is, as I can't get ** working on a network drive, is there an alternative that would allow me to have Gulp check all subdirectories on a watch? Any help is much appreciated.
You can do this by replacing the '**/*.js'
to **/**/*.js
. This will find any javascript files you have.
Here is the cumulation of my comments as an answer :P
Have you checked to see if any of the gulp plugins that supply similar functionality might avoid the issue? For example this one: http://npmjs.com/package/gulp-watch
If you look in the package.json of gulp-watch you will notice that they have a dev depency on a package called glob where as gulp itself does not. This leads me to believe that gulp may have their own implementation of "globbing" whereas gulp-watch uses a different package. It's there that I am hoping (for you :D) that you might get a better result.
Another thing, have you tried mapping your network location as a local drive and then running your task with that as your cwd? I'd try mapping the drive first. That has a good chance of working for a lot less effort ;)
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.