I am wondering how to pass a single file to gulp task.
I don't want to filter entire collection of files and also don't want to waste resources to parse all files from collection by task.
So I thought the best way is to pass a single changed file from gulp.watch() to gulp task, but found no working solution.
gulp.task('html', function(file) {
return gulp.src(file)
.pipe(fileInclude(fileIncludeConf))
.pipe(gulp.dest(paths.dest.templates));
});
gulp.task('watch', function() {
gulp.watch(path.src.templates).on('change', function(file) {
// gulp run 'html' task with 'file' as src
})
});
Is there a way to run gulp tasks like that? I've tried with function instead of task but it don't works.