user1995781
user1995781

Reputation: 19453

How to set gulp-watch options

On the gulp-watch page (https://github.com/floatdrop/gulp-watch) it shows the gulp-watch can be configured via the options.

This is how I use the gulp-watch:

watch('/public/app/**/*.html',function(){
    runSequence('templatecache');
}).on('error', standardHandler);

So, how I can put the option? Do I need to put options on every watch? Is there any global options?

Upvotes: 1

Views: 1409

Answers (1)

Jack Guy
Jack Guy

Reputation: 8523

Options are the second argument to watch.

watch('/public/app/**/*.html', {someOptionHere: true}, function () {});

There's no global configuration, and I'd recommend placing each options object individually, but if you'd like you can create a shared config object and then extend each one as necessary.

var extend = require('util')._extend;
var globalOptions = {
   someOption: true
}

watch('/somePath/*.js', extend(globalOptions, { another: 'option' }), function () {})

Upvotes: 1

Related Questions