如果只应该监视绝对文件路径,那么gulp watch任务是否需要使用globs?
以下是我的例子:
const files = {
style: path.join(paths.config, 'style.css')
};
const globs = {
style: path.join(paths.config, '/**/', 'style.css')
};
function assets() {return gulp.src([...]).pipe(gulp.dest(...);}
gulp.task('watch-glob', function() {
gulp.watch(glob.style, assets);
}
gulp.task('watch-file', function() {
gulp.watch(files.style, assets);
}
第一个观察任务正常,第二个只能工作一次。