Gulpjs的观看任务似乎只适用于全球

时间:2018-03-07 15:12:58

标签: gulp

如果只应该监视绝对文件路径,那么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);
}

第一个观察任务正常,第二个只能工作一次。

0 个答案:

没有答案