Search code examples
javascriptgulpgulp-watch

Gulp watch not triggering


I am working on a project that uses gulp to concatenate compiled vue assets with other javascript assets.

When running gulp, all runs successfully.

However, now I need to add a watcher on the compiled vue file as show below.

gulp.task('watch', ['scripts'], function() {
    gulp.watch('js/vue/compiled.js', { ignoreInitial: false });
});  

While the watcher process seems to kickoff, it does not update when the compiled.js file gets updated. Any idea why this is?


Solution

  • Usually how I write gulp tasks is like this:

    gulp.task('watch', function() {
        gulp.watch('js/vue/compiled.js', ['scripts'], { ignoreInitial: false });
    });