Answer the question
In order to leave comments, you need to log in
Why is gulp watch collecting files endlessly?
Hello, I ran into a problem: When you change the file 1.styl - watch starts to run endlessly. Compiled a basic example, but it refuses to work. gulp version - 4.0
const gulp = require('gulp')
const stylus = require('gulp-stylus')
gulp.task('watch', function(){
gulp.watch('./src/**/*.styl', gulp.parallel('build'));
});
gulp.task('build', function(){
return gulp.src('./src/styl/1.styl')
.pipe(stylus())
.pipe(gulp.dest('./build'))
})
gulp.task('default', gulp.parallel('build', 'watch'))
gulp.task('build', function(){
return gulp.src('./src/styl/1.styl')
.pipe(stylus())
.pipe(gulp.dest('./build'))
})
gulp.task('build', function(done){
console.log('build');
done();
})
gulp.task('build', function(done){
console.log(gulp.src('src/styl/1.styl'));
done();
})
Answer the question
In order to leave comments, you need to log in
gulp.parallel('build', 'watch') this thing loops everything for you, but in fact the build and watch tasks do the same thing tobish build collects tsfesr looks at the changes and again collects as a result in a circle to infinity
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question