M
M
mWan2019-01-03 18:52:57
gulp.js
mWan, 2019-01-03 18:52:57

What is wrong with my gulpfile.js?

var gulp = require('gulp');
var less = require('gulp-less');

gulp.task('less', function() {
         return gulp.src('less/*.less')
                        .pipe(less())
                        .pipe(gulp.dest('./css'));
});

gulp.task('watch', function() {
    gulp.watch('./less/*.less', ['less']);
});

When I launch the less task, then everything is fine, when I launch the watch task, it throws an error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mWan, 2019-01-03
@mWan

Instead of:

gulp.task('watch', function() {
    gulp.watch('./less/*.less', ['less']);
});

Did it like this:
gulp.task('watch', function() {
    gulp.watch('./less/*.less',  gulp.series('less'));
});
gulp.task('default', gulp.series('watch'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question