3

I would like my gulpfile.js task watch to run when an html file in the path is updated, not just javascript files. it seems like even though my base directory does not specify *.js, that it what it assuming.

The relevant part of my gulpfile.js is below.

gulp.task('watch', function () {
    var baseDir = format('./%s',tenantName);
    var combinedArgs = merge(watchify.args, { debug: true });
    var b = browserify(baseDir,combinedArgs);
    var watcher = watchify(b);

    bundle(watcher);
    watcher.on('update', function () {
        bundle(watcher);
    });
    watcher.on('log', gutil.log);

    browserSync.init({
        server: './dist',
        logFileChanges: false
    });
});
Peter Kellner
  • 14,748
  • 25
  • 102
  • 188

1 Answers1

0

What way are you requiring your templates in js files?

I recently started using stringify which converts any html file that is loaded through the browserify require to a string. When I did that, watchify started taking the html changes into account. If the files aren't explicitly required though it won't work.

unflores
  • 1,764
  • 2
  • 15
  • 35