我读到gulp包提供的watch函数不会在新文件上触发(实际上也没有)。但后来我在某处读到,它应该可以和gulp-watch插件很好地配合使用。所以我安装了它并设置了我的gulpfile,但仍然是一样的,每当我放入新文件时,它都不会运行任务。
(gruntfile.js)
function gulpTemplates() {
return gulp.src(path.templates)
.pipe(jade())
.pipe(gulp.dest('./public/templates'));
}
...
gulp.task('watch', function () {
watch(path.components, gulpBower);
watch(path.index, gulpJade);
watch(path.templates, gulpTemplates);
watch(path.styles, gulpSass);
watch(path.scripts, function () {
gulpLint();
gulpJs();
});
});有没有可能实现这一点,让gulp-watch插件监视新文件?
发布于 2015-01-21 17:30:58
能够监视文件夹将是一个更好的选择。
https://stackoverflow.com/questions/27972067
复制相似问题