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
13
votes
1 answer

difference between watchify and gulp.watch

I have just started using Browserify with gulp and I came across examples using watchify. What I don't understand is that why not use gulp.watch instead? What is the difference between watchify and gulp.watch?
Flake
  • 1,386
  • 17
  • 31
13
votes
5 answers

Live reload for electron application

I want to use a combination of VScode + Gulp + Electron to build an application. A nice feature of the development workflow would be to add an live reload task to my Gulp watch task, to reload the Electron application on every change. Any Idea how…
chrisber
  • 730
  • 1
  • 12
  • 27
13
votes
6 answers

Gulp browser-sync only works once

I'm trying out Gulp on one of my projects and I wanted to run it like I used to with Grunt watch. Meaning, it has to watch less files and js files, lint, merge, compile and refresh the browser once all that is done. I managed to make it work with…
Vallieres
  • 859
  • 7
  • 19
13
votes
6 answers

Within Docker VM, Gulp-Watch Seems to not work well on volumes hosted from the host OS

So I have a setup, probably as most people have, where their app code is mounted into a Docker container through a separate volume. The problem is that if I run gulp, and specifically gulp-watch, to watch for file modifications etc. within docker,…
adrian
  • 2,326
  • 2
  • 32
  • 48
12
votes
3 answers

Browser-sync TypeError args.cb is not a function

I'm using browser-sync in gulp task for example : gulp.task('gulp-task',function(){ browserSync.init({ server:{ baseDir: 'app' } }) //rest of task }); I use this gulp task in gulp watch for( for example )…
Hadi Rasouli
  • 1,871
  • 3
  • 27
  • 43
12
votes
1 answer

Docker development workflow with node.js

I'm trying to use docker with a node.js web app i'm working on. I have familiarized myself with the docker concepts and gotten up and running with the example here: https://docs.docker.com/examples/nodejs_web_app/ I get the general process...write…
john_ryan
  • 1,557
  • 1
  • 16
  • 34
12
votes
5 answers

Proxy URL not working with BrowserSync Gulp task

Can someone tell me why my proxy URL isn't working with BrowserSync and Gulp? Instead, it just keeps using http://localhost:3000 as the dev URL. gulp.task('watch', ['bs'], function() { gulp.watch('scss/*.scss', ['scss',…
Cofey
  • 11,144
  • 16
  • 52
  • 74
11
votes
0 answers

gulp stop/cancel running task

How can I cancel/stop a current running task in gulp? My task: gulp.task('scripts', function() { return gulp.src('js/main.js') .pipe(browserify({ transform: [to5ify] })) .pipe(gulp.dest('./dist')); }); It runs in a…
Dennis
  • 397
  • 1
  • 5
  • 16
11
votes
4 answers

Gulp.js stops compiling LESS when watched after there has been an error in the LESS files

I'm having a problem with gulp. I run gulp-watch along with gulp-less and gulp-clean. Everything is running perfectly. When I edit somefile.less and I save it with a semi-colon missing or maybe I accidentally leave a trailing ;s, just have errors in…
turbalan
  • 431
  • 3
  • 10
10
votes
1 answer

error handling in gulp 4

I'm trying to write simple watch task that will watch my tests files and on change compile them and run using gulp-jasmine. My watch task: gulp.task('watch', function () { gulp.watch(['tests/**/[^_]*.ts'], gulp.series(['compile_tests',…
SET001
  • 11,480
  • 6
  • 52
  • 76
10
votes
1 answer

Gulp-watch is not picking up new files

I'm trying to run a task whenever a file get's changed, delete or a new file is added. The first two work, however: when a new file is added it's not being picked up. I installed the package gulp-watch and I have this task: var gulp =…
NewGulpUserxx
  • 225
  • 4
  • 7
10
votes
2 answers

Why don't newly added files trigger my gulp-watch task?

I have a gulp task which uses gulp-imagemin to compress images. When I add new files to this directory I'd like for this task to compress them as well. I read that gulp.watch doesn't trigger on new files and that I should try gulp-watch so I used it…
Jesse Hattabaugh
  • 7,876
  • 8
  • 34
  • 38
9
votes
1 answer

gulp-inject not working with gulp-watch

I am using gulp-inject to auto add SASS imports as they are newly created in my project. This works fine, the new SASS files are imported correctly, however when an already imported file is deleted whilst gulp-watch is running it crashes with the…
Alex
  • 2,651
  • 2
  • 25
  • 45
9
votes
1 answer

Running gulp watch in task runner explorer by setting bindings to 'After Build' in Visual Studio 2015

I am trying to run gulp watch by setting bindings property of watch to 'After Build' in Task runner explorer. I tried to run application, during build it triggered my watch task from gulp and it's still running. But my application is not running in…
VR1256
  • 1,266
  • 4
  • 28
  • 56
9
votes
1 answer

gulp doesn't exit after running tasks

When running gulp on server it doesn't exit after finishing tasks. This is what I get: [01:16:02] Using gulpfile /test/test/gulpfile.js [01:16:02] Starting 'clean'... [01:16:02] Finished 'clean' after 11 ms [01:16:02] Starting…
Besbes Riadh
  • 811
  • 2
  • 10
  • 23
1
2
3
55 56