Answer by Chintsu for How to Gulp-Watch Multiple files?
This works for me (Gulp 4): function watchSass() { return gulp.watch(sassGlob, { ignoreInitial: false }, buildCss) } function watchImages() { return gulp.watch(imagesGlob, copyImages) } exports.watch =...
View ArticleAnswer by Alessandro Catania for How to Gulp-Watch Multiple files?
If you convert your tasks into functions function task1(){ return gulp... ... } There are then 2 useful methods you can use: GULP.SERIES will run the tasks synchronously gulp.task('default',...
View ArticleAnswer by user6123723 for How to Gulp-Watch Multiple files?
@A.J Alger's answer worked for me when using Gulp v3.x. But starting with Gulp 4, The following appears to work for me. Notice that each task has to return a value or call "done()". The main task in...
View ArticleAnswer by Lyra for How to Gulp-Watch Multiple files?
One problem that has arisen for multiple people (including me) is that adding a gulp.filter outside of the task causes gulp.watch to fail after the first pass. So if you have something like this: var...
View ArticleAnswer by Kelly J Andrews for How to Gulp-Watch Multiple files?
gulp.task('default', ['css', 'browser-sync'] , function() { gulp.watch(['sass/**/*.scss', 'layouts/**/*.css'], ['css']); }); sass/**/*.scss and layouts/**/*.css will watch every directory and...
View ArticleAnswer by A. J. Alger for How to Gulp-Watch Multiple files?
You can write a watch like this. gulp.task('watch', function() { gulp.watch('path/to/file', ['gulp task name for css/scss']); gulp.watch('path/to/file', ['gulp task name for js']); }); This way you can...
View ArticleHow to Gulp-Watch Multiple files?
I have something like this: gulp.task('default', ['css', 'browser-sync'] , function() { gulp.watch(['sass/**/*.scss', 'layouts/*.css'], function() { gulp.run('css'); }); }); but it does not work,...
View ArticleAnswer by Alexander Dischberg for How to Gulp-Watch Multiple files?
As of gulp 4, these are two possibilities:const { watch, series, parallel } = require('gulp');function watchTask(cb) { // this will execute all task on any changes watch(['src/**/*'],...
View Article