Closed Foolyou closed 9 years ago
Are you using gulp 4? The watcher is redone, you should try that
Thanks @contra.
Do you mean with gulp 4
which uses chokidar
, we do not need gulp-watch
any more?
I'm considering temporarily use gulp-changed
with gulp-watch
to avoid this issue, and test gulp 4
with my huge old gulpfile.
Ah, found the way.
gulp.task('coffee', function (done) {
var src = ...;
var dest = ...;
return gulp.src(src)
.pipe(changed(dest))
.pipe(coffee().on('error', function (p) {
gutil.log(p);
done();
}))
.pipe(gulp.dest(dest));
});
gulp.task('watch', function (done) {
var src = ...;
var dest = ...;
return gulp.src(src)
.pipe(watch(src).on(change, function () { gulp.start('coffee'); }))
});
@contra I stepped over this issue. With my file watcher I need to restart my gulp task. Can you tell me more about the watcher in Gulp 4? I'm currently using 3.9.1.
My gulpfile:
I used
gulp watch
, and wrote a coffee file which was then compiled. Then I made a syntax error in that coffee file, so gulp logged an error. Gulp still logged file changes when I fixed that syntax error & saved, however coffee file was not compiled again.