Chrome Extension

Watch files in Gulp

var gulp = require('gulp');

gulp.task('watch', function() {'app/scss/*.scss', gulp.series('sass'));'app/js/*.js', gulp.series('minifyjs'));
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

You can apply a watch on files using gulp means if there are any changes to those files you can run specific tasks.

In the code snippet, we have created a task named 'watch'. When we run the 'gulp watch' command in the terminal it will start the watch task and continuously watch all .scss files in 'app/scss/' folder and all js files in 'app/js/' folder.

If there is any change in .scss files, it will run the task 'sass' and it will run task 'minifyjs' if there is any change in js files.

Was this helpful?