0

i downloaded livereload extension but it's not working, here's the error.

Error: watching ./src/*.css: watch task has to be a function (optionally generated by using gulp.parallel or gulp.series)

var
    gulp = require("gulp"),
    livereload = require("gulp-livereload");

gulp.task("reload-css", function() {
    gulp.src('./src/*.css')
        .pipe(livereload());
});

gulp.task("default", function() {
    livereload.listen();
    gulp.watch('./src/*.css', ['reload-css']);
});

So what should i do now ?

Tiko
  • 1,241
  • 11
  • 19

1 Answers1

1

it looks like you're using gulp 4, but write gulp 3 syntax. Try

gulp.watch('./src/*.css', gulp.series('reload-css'))

Check out the gulp 4 docs. This post highlight the differences in the new gulp.

Derek Nguyen
  • 11,294
  • 1
  • 40
  • 64