I currently have 3 watch tasks as so:
gulp.task('watch', function(){
gulp.watch(sassDir + '/*.scss', ['sass']);
gulp.watch(cssDir + '/*.css', ['css']);
gulp.watch(jsDir + '/*.js', ['js']);
})
My issue right now is that when Sass throws an error all watch tasks stops.
I then added .pipe(sass({errLogToConsole: true}))
- which seems to keep my sass watch task alive even with an error, however the two other watch tasks doesnt seem to run.
How do I keep all of my watch tasks a live, so that an error in my sass file doesn't stop everything from being compiled?
My setup:
gulp.task('sass', function () {
gulp.src(sassDir + '/**/*.scss')
.pipe(sass({errLogToConsole: true}))
.pipe(gulp.dest(sassTargetDir));
});
gulp.task('css', function() {
gulp.src(cssDir + '/**/*.css')
.pipe(autoprefix({
browsers: ['last 40 versions'],
cascade: false
}))
.pipe(gulp.dest(cssTargetDir))
.pipe(minify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(cssTargetDir));
});
gulp.task('js', function() {
gulp.src(jsDir + '/**/*.js')
.pipe(gulp.dest(jsTargetDir))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(jsTargetDir))
});
gulp.task('watch', function(){
gulp.watch(sassDir + '/*.scss', ['sass']);
gulp.watch(cssDir + '/*.css', ['css']);
gulp.watch(jsDir + '/*.js', ['js']);
})
gulp.task('default', ['sass','css','js','watch']);