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
0
votes
0 answers

Gulp.js Concat - ENOENT, no such file or directory

I'm having a problem setting up a basic Gulpfile. My JS task does not work. I get this error: Error: ENOENT, no such file or directory at Function.startup.resolveArgv0 (node.js:815:23) at startup (node.js:58:13) at node.js:906:3 What am I missing?…
user154759
0
votes
1 answer

Gulp run and watch

I've just started playing with gulp. How would the following be combined? gulp.src('src') .pipe(traceur()) .pipe(gulp.dest('build')); watch('src') .pipe(traceur()) .pipe(gulp.dest('build')); Is there a more standard way than using a…
simonzack
  • 19,729
  • 13
  • 73
  • 118
0
votes
1 answer

gulp-jscs doesn't output anything when used in gulp-watch pipeline

I have the following (simplified) set-up in my gulpfile: var gulp = require('gulp'); var jshint = require('gulp-jshint'); var jscs = require('gulp-jscs'); var watch = require('gulp-watch'); var paths = { scripts: ['js/*.js'] } var…
Tomalak
  • 332,285
  • 67
  • 532
  • 628
0
votes
1 answer

Copy contents of image file to the clipboard using gulp

I'm writing a gulp task to do the following: Watch an image file for changes If image file has changed, copy the contents of the image to the clipboard, ready for me to paste. Note: I'm on Windows and am using nircmd.exe to do the copy of the…
user791793
  • 413
  • 1
  • 6
  • 19
0
votes
0 answers

Dynamical gulp.watch executes too often

I want to build watchers dynamically. Therefor I have the following code: gulp.task('watch', ['build-styles'], function() { for(var j = 0; j < watchStylesIndicator.length; j++) { setWatchPipe(watchStylesIndicator[j]); } gulp .watch([…
Lars
  • 45
  • 6
0
votes
1 answer

gulp + browser-sync - why gulp errors on removing directory from app?

In a simple gulp + browser-sync project here, all file add/delete/change are working correctly, but when I delete a directory from app gulp/browser-sync throws an error like below: events.js:72 throw er; // Unhandled 'error' event …
abhishekisnot
  • 113
  • 2
  • 8
0
votes
0 answers

Performance issue with gulp.watch() on directory with ~400 files

I’ve noticed that if I gulp.watch() a directory with ~400 Markdown files, my Gulp task takes a long time to initialize (~19s on my machine). If I remove this specific .watch() call, my task initialization time shrinks to less than…
Šime Vidas
  • 182,163
  • 62
  • 281
  • 385
0
votes
1 answer

gulp watch "TypeError: Object function (server)"

I can't get gulp watch to work. It gives me an error that starts with "TypeError: Object function (server)". Here's the full error (sorry for the screenshot): http://cl.ly/image/3p0j1F2L1S0I Here's my gulp file: var gulp = require('gulp'), //…
A Herrera
  • 612
  • 1
  • 5
  • 17
0
votes
1 answer

If gulp is watching conditional

How can I apply a condition argument based on if gulp is watching or not? gulp.task('styles', function(){ return gulp.src('sass/**/*.scss') .pipe(sass()) if (isWatching) { // gulp.dest to the .tmp directory if "gulp watch" …
0
votes
1 answer

Why does gulp-sprite-generator throw "SyntaxError: Unexpected token ;"?

Running my gulp task im getting the following error: SyntaxError: Unexpected token ; - im wondering what this relates to in terms of my Gulp task? var gulp = require('gulp'); var sprite = require('gulp-sprite-generator'); gulp.task('sprites',…
user1231561
  • 3,239
  • 6
  • 36
  • 55
0
votes
0 answers

Gulp watch, incremental build

I'm struggling to make gulp-watch behave as I desire. This small project is tooling to build HTML5 emails templates from Jade+SASS, in a repeatable way. The directory structure is as such: . ├── Gulpfile.coffee ├── Gulpfile.js ├── build │   ├──…
Lee Hambley
  • 6,270
  • 5
  • 49
  • 81
0
votes
1 answer

How to Pass a Relative Destination Path With gulp-watch and gulp-less

So I want to watch for changes made to less files and have the destination path for the CSS be the same folder where the changed less file. Here's the general file structure: root | site1 | | | includes | | | | …
leggomuhgreggo
  • 155
  • 1
  • 9
0
votes
1 answer

gulp-watch doesn't update gulp-jshint

what's wrong with this code: var gulp = require('gulp'); var watch = require('gulp-watch'); var connect = require('gulp-connect'); var jshint = require('gulp-jshint'); var stylish = require('jshint-stylish'); //lint module.exports =…
Whisher
  • 31,320
  • 32
  • 120
  • 201
0
votes
1 answer

Rebuild only affected jade files with gulp-jade-find-affected

I'm trying to use gulp-jade-find-affected to rebuild with a watcher only the affected files. For example, if I do an update in a layout or mixin file, I want to rebuild only the files who includes the mixin. But the example on the plugin's Github…
AshJS
  • 1
  • 1
0
votes
2 answers

Gulp watch is triggered for every file separately

I think I need general improvement of my gulp file. But what is currently bothering me the most, is the behavior of gulp watch. I use gulp-watch to reload gulp-connect to update chrome. The problem is, it is triggered for every file separately. Here…
Angelo.Hannes
  • 1,729
  • 1
  • 18
  • 46