Onebite.dev

Developer tips & trick, one bite at a time

Watch Tasks in Gulpjs

Learn how to watch Tasks in Gulpjs so the files can reload themselves when certain task triggered

Create watch function

To make sure every tasks run at the first load, I’ll be using series function, which means run multiples tasks in order.

//Assume I only want watch if any CSS or Javascript files change
//So I can run their tasks
function watchTask() {
    gulp.watch([cssPath, jsPath], gulp.parallel(cssTask, jsTask))
}

exports.default = gulp.series(
    gulp.parallel(cssTask, jsTask, imgTask),
    watchTask
)



This is a post in the Automate frontend task with GulpJS series.



🏊🏾‍♀️ Back Home