Gulp-watch is not picking up new files

安稳与你 提交于 2020-01-01 04:46:07

问题


I'm trying to run a task whenever a file get's changed, delete or a new file is added. The first two work, however: when a new file is added it's not being picked up.

I installed the package gulp-watch and I have this task:

var gulp  = require('gulp'),
    watch = require('gulp-watch');

gulp.task('watch', function() {
  watch(
    ['./src/Scripts/**/*.js'],
    function(ev, cb) {
      console.log('test');
      cb();
    });
});

回答1:


That was a weird problem. Removing ./ from glob fixes it.

var gulp  = require('gulp');
var watch = require('gulp-watch');

gulp.task('watch', function() {
    watch(['src/Scripts/**/*.js'], function(event, cb) {
        console.log('test');
        cb();
    });
});


来源:https://stackoverflow.com/questions/26628003/gulp-watch-is-not-picking-up-new-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!