Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp-watch is not picking up new files

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();
    });
});
like image 964
NewGulpUserxx Avatar asked Oct 29 '14 10:10

NewGulpUserxx


1 Answers

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();
    });
});
like image 191
Heikki Avatar answered Nov 15 '22 20:11

Heikki