Questions tagged [gulp-watch]

A gulp plugin that listens for file changes and emits changed files into the stream. Not to be confused with the built-in gulp.watch().

Installation

npm install --save-dev gulp-watch

Usage

gulp.task('watch-css', function () {
  return gulp.src('css/**/*.css')
    .pipe(watch('css/**/*.css'))
    .pipe(gulp.dest('build'));
});

Recipes

Links

836 questions
4
votes
1 answer

Gulp task not waiting the completion of the previous task

I have a gulp task that uses streams to write a revised file (using gulp-rev) and another task that uses the previously written manifest file for replacing a variables in an html file. My first task: gulp.task('scripts', function() { // other…
Ronnie
  • 4,959
  • 10
  • 51
  • 69
4
votes
3 answers

Gulp run alternative

Everytime I run gulp, I see this message gulp.run() has been deprecated. Use task dependencies or gulp.watch task triggering instead. Example code: var watch = require('gulp-watch'); watch(['public/**/*.js','!public/**/*.min.js'],function(){ …
user1995781
  • 19,085
  • 45
  • 135
  • 236
4
votes
1 answer

Gulp - Pass parameter to inner function

I have a watch-task which loops through an array. The strings inside the array are used to get different file paths to watch for. That's the line with the watch-function. The on-function looks for changes inside these files. If there is a change a…
Lars
  • 45
  • 6
4
votes
0 answers

Not able to concat files while watching with gulp-watch

This is working file if needed to watch 1 by 1 file sources.srchtmlfile = [ "dev/app/**/*.html", "!dev/app/home/home.html", !dev/app/logon/logon.html" ] gulp.task("src.html", function() { return gulp.src(sources.srchtmlfile) …
Amit Mourya
  • 538
  • 1
  • 7
  • 18
4
votes
2 answers

Gulp watch with gulp-file-include

I'm using yeoman/generator-gulp-webapp and I added gulp-file-include. I set up gulpfile.js to include files on build, but I don't know how to set up for gulp watch. Below is my attempt to do this, but it seems that this doesn't work. I don't get any…
Shone Tow
  • 497
  • 4
  • 14
4
votes
2 answers

How to restart gulp watch when git branch changes

It's useful to have gulp building files using a watch task. In my case I have a task which watches a php directory for changes and lints/copies on change, a JS directory which concatenates and copies, and SASS which compiles to CSS on change. If I…
M1ke
  • 6,166
  • 4
  • 32
  • 50
4
votes
1 answer

gulp watch and reload jekyll, sass, js

I'm trying to build a gulpfile which will watch jekyll/sass/js and sync with a browser. The script correctly watches the changes of jekyll, rebuilds and injected all the changes in the browser. But I can't figure out why it's not syncing sass/js…
iamskok
  • 600
  • 5
  • 19
4
votes
2 answers

Skipping Tasks Listed as Dependencies in Gulp

I have looked all over the documentation and NPM to try to find a solution to this, but I have had no luck. I would like to have the option to skip the tasks that I list as dependencies when running a specific task. For example, if I have the…
nmagerko
  • 6,586
  • 12
  • 46
  • 71
4
votes
2 answers

gulp.watch() not working with ftp update

I have recently learnt gulp and scripted this gulp script on my local computer, so that it can watch for any changes, and compile my javascripts (in this case, ./js/main.js with its dependencies) into a single file ./js/bundle.js: var gulp =…
vickson
  • 73
  • 1
  • 1
  • 8
4
votes
1 answer

gulp-watch works only on initial run

What I do? Run gulp (SCSS files are being processed, I get a CSS file) I change any SCSS file again Expected: CSS file from 1. is updated with the changes from 2. What happens? CSS file from 1. isn't changed Command line output: $…
kleinfreund
  • 6,546
  • 4
  • 30
  • 60
3
votes
2 answers

'node_modules' is not recognized as an internal or external command, operable program or batch file

I am using gulp in my application. installed gulp put the npm script run the script by using "npm start" Got the error:- **> start node_modules/.bin/gulp watch 'node_modules' is not recognized as an internal or external command, operable program…
Ranjan Singh
  • 123
  • 2
  • 9
3
votes
2 answers

SyntaxError: Cannot use import statement outside a module when run gulp server / gulp watch in my ruby project

On my ruby project when I try to run gulp (gulp server, gulp watch) I have the following error : Users/workspace/website2019/gulpfile.babel.js:1 import del from 'del'; ^^^^^^ SyntaxError: Cannot use import statement outside a module I don't get…
TheGame
  • 91
  • 1
  • 8
3
votes
1 answer

Gulp 4 watch() TypeError: expected a string

I have encountered a problem while starting gulp. The info I got is from https://coder-coder.com/gulp-4-walk-through/ and https://www.youtube.com/watch?v=-lG0kDeuSJk. my gulpfile.js // Initialize modules const { src, dest, watch, series, parallel }…
Branko Anokic
  • 35
  • 2
  • 6
3
votes
3 answers

How can I restart my Gulp task on subsequent saves?

I have a set of Gulp (v4) tasks that do things like compile Webpack and Sass, compress images, etc. These tasks are automated with a "watch" task while I'm working on a project. When my watch task is running, if I save a file, the "default" set of…
JacobTheDev
  • 17,318
  • 25
  • 95
  • 158
3
votes
1 answer

How to get Gulp watch working after migration from v3 to v4?

I have an app with a very moderate gulpfile. I've just upgraded Gulp from v3.9.1 to v4.0.2 and adapted the gulpfile.js. All tasks are working fine again, only the watching is not. There are no errors, but Gulp watch seems not to be checking the…
automatix
  • 14,018
  • 26
  • 105
  • 230