Open Sawtaytoes opened 9 years ago
can i see your html.clean
task code?
gulp.src(src)
.pipe($.newer(dest))
.pipe($.using({prefix: 'html.build', color: 'yellow'}))
.pipe($.debug({title: 'html.build'}))
.pipe(gulp.dest(dest))
ok, maybe I've got it. I use gulp sync feature for the gulp-sync. so you have to fit in gulp's sync rule.
you can choose from 2 way below.
gulp.task('html.clean', function(){
return gulp.src(src)
.pipe($.newer(dest))
.pipe($.using({prefix: 'html.build', color: 'yellow'}))
.pipe($.debug({title: 'html.build'}))
.pipe(gulp.dest(dest));
});
gulp.task('html.clean', function(callback){
gulp.src(src)
.pipe($.newer(dest))
.pipe($.using({prefix: 'html.build', color: 'yellow'}))
.pipe($.debug({title: 'html.build'}))
.pipe(gulp.dest(dest))
.on('end', function(){
callback();
});
});
if you choose do callback
, you have to care about error handling.
sometimes, it stops due to a gulp plugin error.
some plugins don't implement enough about error and end event.
Returning the stream didn't fix it, but I could try the callback method and see if that helps.
If I do a delete, then a write, sometimes the write errors because the file being written is also being deleted at the same time.
Example:
In this example, clean removes the file and build will create the file. Clean is finishing up at the time build runs. It doesn't always happen, but it happens enough to be bothersome; especially when I run a bunch of async synced tasks at once.