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
6
votes
3 answers

gulp-watch only runs once

Gulp watch runs only once on the first change. I am running Wordpress on apache2 on ubuntu 14 and am using a tutorial. It illustrates how to use gulp to watch for changes. It works okay for the first change - refreshes the browser which is…
6
votes
2 answers

Live reload is not working after upgrading to Gulp 4

My gulpfile.js looks like below, var gulp = require('gulp'); var pug = require('gulp-pug'); var sass = require('gulp-sass'); var minifyCSS = require('gulp-csso'); var concat = require('gulp-concat'); var sourcemaps = require('gulp-sourcemaps'); var…
Polly Banerjee
  • 197
  • 1
  • 10
6
votes
2 answers

gulp.series() not function when running multiple tasks

I am trying to run multiple gulp tasks one after another in synchronised fashion but i got the following error TypeError: gulp.series is not a function Code gulp.task('default',function () { gulp.watch('resources/assets/js/components/*.js',…
Jabaa
  • 1,743
  • 7
  • 31
  • 60
6
votes
1 answer

Laravel elixir "gulp watch" doesn't watch for Javascript changes

I'm trying to use laravel elixir and it works fine. gulpfile.js: const elixir = require('laravel-elixir'); require('laravel-elixir-vue-2'); elixir(mix => { mix.sass('app.scss') .webpack('app.js'); }); But when I use gulp watch it…
paolobasso
  • 2,008
  • 12
  • 25
6
votes
1 answer

How to kill all servers running in gulp using one bash command

I have created a gulpfile.js to start my servers, and its content can be seen below. gulp.task('default', function () { if(!fs.statSync('/etc/aptly.conf').isFile()){ process.exit(); return; } console.info('Starting static file…
python
  • 4,403
  • 13
  • 56
  • 103
6
votes
1 answer

Gulp.js serve src files WITHOUT browserSync?

Scaffolded a new project with Yeoman Gulp-Angular. I understand the premise of BrowserSync, but frankly I cannot comprehend how anyone tolerates having their network requests flooded by this: I would like to remove BrowserSync from my project…
Charney Kaye
  • 3,667
  • 6
  • 41
  • 54
6
votes
1 answer

How do I run gulp eslint continuously and automatically while fixing files -- how to set up watch

I am trying eslint with gulp. I have set up a task like this: gulp.task('lint', function () { return gulp.src([ 'components/myjs.js' ]) // eslint()…
techguy2000
  • 4,861
  • 6
  • 32
  • 48
6
votes
4 answers

gulp command giving errors of modules can not find

I am trying to set up the basic aurelia app on windows. I have followed instructions from: http://aurelia.io/get-started.html, which includes: Installed node js Installed the gulp using: npm install -g gulp Installed jspn by using: npm install -g…
vish
  • 165
  • 2
  • 13
6
votes
2 answers

How to pass a parameter to gulp-watch invoked task

I am trying to pass a parameter to a task that is being invoked by gulp-watch. I need it because I am trying to build a modular framework. So if a file changes in module 1, the other modules don't need to be rebuild. And I want just one function…
Chris Laarman
  • 1,559
  • 12
  • 25
6
votes
1 answer

Gulpfile that efficiently compiles only changed TypeScript files

I'm trying to make gulp compile and watch TypeScript files. This is what I have got so far var tsProject = plugins.typescript.createProject( { removeComments: false, target: 'ES5', module: 'amd', noExternalResolve: false, …
Klas Mellbourn
  • 42,571
  • 24
  • 140
  • 158
5
votes
0 answers

UNKNOWN error thrown by gulp watch task

I'm facing a 'randomly' occurring fatal error whilst using a watch task for gulp. General setup I'm on Windows 10, in which I host a Debian VM using VMWare. I have a network mapping directly into the app folder on the web server. As IDE, I use…
Fer
  • 4,116
  • 16
  • 59
  • 102
5
votes
3 answers

Gulp 4 - watch not watching changes

Today I migrated to Gulp 4, but I'm not able to get my watch function to work. // Watch gulp.task('watch', gulp.series('typescript', 'sass', 'browserSync', function(){ gulp.watch('./app/styles/**/*.scss', gulp.series('sass')); …
5
votes
1 answer

Run a gulp watch simultaneously than gretty

I'm trying to run a gulp watch when running my Java web-app with Gretty. I'm using this plugin to run gulp from Gradle. For the moment, I'm just able to run a single gulp build before the app run by doing this: appRun.dependsOn gulp_build What I…
ThibaultV
  • 529
  • 1
  • 5
  • 24
5
votes
1 answer

Aurelia CLI app-bundle automatic update gets slow

Hi I have a web application runnig on the Aurelia CLI. From what I’ve read in the documentation, the Aurelia CLI runs always “bundled” and never targeting directly source files. By running the “au run –watch” command, Aurelia “listens” to file…
Mirko Lugano
  • 975
  • 1
  • 11
  • 26
5
votes
1 answer

Gulp browserSync keeps scrolling to top after reload

I have a problem with Gulp and BrowserSync, is really a small issue but is bugging me. Every time I change the scss file and I ran sass() to combile it the browser reloads and scrolls back to the top. Is there a way to prevent the browser to do that…
Christos312
  • 466
  • 6
  • 18