I am new to Gulp. I have two tasks:
gulp.task('jadehtml', function() {
var YOUR_LOCALS = {};
gulp.src('source/jade/*.jade')
.pipe(jade({
locals: YOUR_LOCALS,
pretty: true
}))
.pipe(gulp.dest('build'))
});
// End Gulp Jade
// default task
// sass
gulp.task('sass', function () {
return gulp.src('source/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('build/css'));
});
Now they work perfectly fine when run individually. But when I use the gulp.watch()
command they give me an error. Here is my watch
task:
gulp.task('watch', function() {
gulp.watch('source/jade/*.jade', 'jadehtml');
gulp.watch('source/scss/*.scss', 'sass');
});
This is the error:
The tasks
parameter that you pass to gulp.watch()
always has to be an array, even if it's just one task. So instead of this:
gulp.watch('source/jade/*.jade', 'jadehtml');
gulp.watch('source/scss/*.scss', 'sass');
You need to do this:
gulp.watch('source/jade/*.jade', ['jadehtml']);
gulp.watch('source/scss/*.scss', ['sass']);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With