Gulp.js is an awesome tool for running build tasks. The watch-plugin is really easy to use and works great.
However: by default, watch
will not consider any new files that you add while watch
is already running. To fix this, you can set the options.glob
-parameter:
gulp.src('src/js/**/*.js').pipe(watch({ glob: 'src/js/**/*.js' }, function() {gulp.start('browserify');}));
With this configuration, gulp will watch all files that match src/js/**/*.js
and automatically add any new files with that pattern to watch.
gulp now includes watch functionality by default, it's easier to setup, but it doesn't pickup when new files are added:
gulp.watch('src/js/**/*.js', ['browserify']);
Hi, I’m Max! I'm a fullstack JavaScript developer living in Berlin.
When I’m not working on one of my personal projects, writing blog posts or making YouTube videos, I help my clients bring their ideas to life as a freelance web developer.
If you need help on a project, please reach out and let's work together.
To stay updated with new blog posts, follow me on Twitter or subscribe to my RSS feed.