以下是我gulpfile.js的代码片段,每当我保存或更改文件时,任务运行两次而不是一次,为什么?我只想让它运行一次。
var gulp = require('gulp');
gulp.task('default', function() {
gulp.watch('server/**/*.js', function(){
console.log('This runs twice everytime I change/save a javascript file located at server/**/*.js');
});
});
我曾经遇到过 grunt 和名为 grunt-contrib-watch 的插件的同样问题。