Reputation: 358
So mine is a pretty simple gulp file.
const gulp = require("gulp");
const ap = require("gulp-autoprefixer");
function styles() {
return gulp
.src("./style.css")
.pipe(ap("last 2 versions"))
.pipe(gulp.dest("./dist"));
}
function watch() {
gulp.watch("./style.css", styles);
}
exports.watch = watch;
exports.styles = styles;
exports.default = watch;
Running the styles task independently does produce the autoprefixed css.
The watch task however gets stuck on Starting 'watch'...
Can someone tell me what's wrong.
Gulp CLI Version: 2.0.1 Gulp Local Version: 4.0.0 Node: 10.15.0 OS: Windows 10 (WSL)
Upvotes: 4
Views: 3409
Reputation: 1151
This might be an old question but I encountered the same issue when upgrading an old project from gulp 3 to gulp 4. I had a watcher that should start before a server spun up but I got stuck at Starting 'watch'...
I could fix it by passing a done
callback to the watcher task and calling it after the watch command. This led the server to start after it gets noticed that the watcher went through, like so:
gulp.task('serve', gulp.series(['task1', 'task2'], function (done) {
gulp.watch(['src/**/*.js']);
gulp.watch(['src/**/*.less']);
done(); // <-- this one
}));
Upvotes: 1