Setup Gulp watch仅在保存文件时运行

时间:2018-04-08 18:43:44

标签: javascript gulp visual-studio-code gulp-watch

我有工作gulpfille,但唯一的问题是,当我编辑.ts文件或html文件时,每次我写一个字母时,watch函数会触发,并且当我输入时它会不断重新加载我的浏览器。

有没有办法设置gulp来保存任务?

// Watch
gulp.task('watch', ['typescript', 'sass', 'browserSync'], () => {
  gulp.watch('./app/scripts/**/*.ts', ['typescript']);
  gulp.watch('./app/styles/**/*.scss', ['sass']);
  gulp.watch('./app/index.html', browserSync.reload);
});

修改

通过在VS Code中将“files.autoSave”设置为“off”来修复。

0 个答案:

没有答案