简体   繁体   中英

I'm getting error in node using gulp and gulp-livereload

i downloaded livereload etension but here's the error.

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

So what should i do now ?

    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']);
    });

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM