I was just wondering if it was possible to pass a function argument inside gulp.series like this gulp.series(scripts(arg), reload)
without getting AssertionError [ERR_ASSERTION]: Task never defined: [object Object]
.
complete objective code below:
//required imports
const watch = () => {
const backendWatcher = gulp.watch('./*.js');
backendWatcher.on('change', (path,stats) => {
log(path,stats);
gulp.series(scripts(path), reload)//error occurs here(line 20)
log("passed :D");
});
}
function scripts(file) {
if(!file) return false, log("no file found");
return gulp.src(`./${file}`)
.pipe(browserify())
.pipe(uglify())
.pipe(gulp.dest('./dist'));
}
function reload(done) {
browserSync.reload();
done();
}
function serve(done) {
browserSync.init({
server: {
baseDir: './',
index: "/index.html"
}
});
done();
}
const dev = gulp.series(serve, watch);
exports.dev = dev;
exports.scripts = scripts;
exports.reload = reload;
error:
AssertionError [ERR_ASSERTION]: Task never defined: [object Object]
at FSWatcher.<anonymous> (gulpfile.js:20:14)
file structure:
Project/
dist/
┣ compiled.js
┗ wow.min.js
┣ gulpfile.js
┣ index.html
┣ package.json
┣ app.js