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

Gulp not watching my scss file correctly

I've seen plenty of stackoverflow solutions to this, but none of the appear to work in my scenario. My gulp watch appears to be watching the file but the output file is not being updated. Running gulp works okay as it default is set to call the…
Simon Willan
  • 378
  • 3
  • 14
5
votes
1 answer

Error referencing my TypeScript modules TS2307: Cannot find module

I am working with the aurelia-typescript-skeleton as the base for my new project. I tried adding a new hello.ts file in src folder export class Hello { sayHello(name:string) : string { return 'Hello ' + name; } } and referenced it in…
Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107
5
votes
1 answer

gulp refresh active tab after code change in chrome extension

I'm developing a chrome extension and I want to automatically refresh the active tab after a code change I got gulp-open to work so I don't need to navigate to chrome://extensions anymore and manually click "reload" now only the active tab refresh…
5
votes
2 answers

Gulp: how to pass parameters from watch to tasks

With gulp you often see patterns like this: gulp.watch('src/*.jade',['templates']); gulp.task('templates', function() { return gulp.src('src/*.jade') .pipe(jade({ pretty: true })) .pipe(gulp.dest('dist/')) .pipe( livereload(…
andig
  • 13,378
  • 13
  • 61
  • 98
5
votes
2 answers

Gulp watch all files but render only one (sass)

I want to make gulp watch for all changes on my work folders but to generate only one file. Because I use scss which imports all required files, there is no need to compile all .css files, only main one. Now, my gulpfile.js contains: var gulp =…
10robinho
  • 520
  • 6
  • 17
5
votes
2 answers

Excluding subdirectory from gulp-watch throwing type error

I'm running the following watch task: gulp.task('watch', function() { gulp.watch('./ui/scss/*.scss', ['styles']); gulp.watch('./js/*.js', '!./js/vendor/*.js', ['scripts']); gulp.watch('./**/*.html', ['html']); }); But it seems to…
jx3
  • 921
  • 1
  • 7
  • 22
5
votes
1 answer

How can I utilize Gulp.watch in Visual Studio 2015?

I want to apply a Gulp watcher to my LESS files so Gulp will create css files whenever a LESS file gets saved. How can I do this? It doesn't seem to be correct/sufficient to write something like this: var gulp = require("gulp"); var moreLess =…
AxD
  • 2,714
  • 3
  • 31
  • 53
5
votes
1 answer

Gulp - SCSS Lint - Don't compile SCSS if linting fails

Just wondering if someone can help me with my Gulp setup. At the moment I am using gulp-sass and gulp-scss-lint with a watch task. What I want to happen is that when an scss file is saved for the linting task to run completely and if any errors or…
Tenatious
  • 849
  • 4
  • 12
  • 32
5
votes
1 answer

Error: EMFILE, too many open files with Gulp.watch

My gulpfile.js looks like this: gulp.task('default', ['build', 'browser-sync'], function () { gulp.watch("**/*.css", ['bs-reload']); gulp.watch(["**/*.js", "!**/*/node_modules/**/*.*"], ['bs-reload']); gulp.watch("**/*.html",…
codebased
  • 6,945
  • 9
  • 50
  • 84
5
votes
1 answer

Laravel 5 Elixir takes too long to compile LESS

I'm currently experiancing a slow down in my development workflow, it is taking around 3-4s for my less to compile and then version, this is causing much annoyance. I would like to 'split' my watcher down so that it is only compiling the changed…
Jono20201
  • 3,215
  • 3
  • 20
  • 33
5
votes
1 answer

Gulp watch...isn't watching?

I am setting up my gulp.js file and everything is working fine except for gulp.watch. When I run "gulp" in the terminal, gulp runs through each task but doesn't watch for changes. Is there something I should change? var gulp = require('gulp'), …
user715564
  • 1,650
  • 2
  • 25
  • 60
5
votes
2 answers

gulp-watch, gulp-watch-less don't fire

I'm having trouble getting gulp-watch or gulp-watch-less to fire after following the documented examples. I originally through the problem was with lazypipe (not shown here), but it appears to me that I'm doing something wrong in the way I'm using…
sak_to
  • 399
  • 4
  • 13
5
votes
2 answers

gulp watch and browserify. watches but doesnt build again

So today is my first day playing around with gulp and grunt or any task runner for js. I got to a place where I was able to change my code in my js files and then run the gulp browserify this works fine. However it was annoying and I wanted to…
Asim Zaidi
  • 27,016
  • 49
  • 132
  • 221
5
votes
2 answers

Enabling gulp-watch conditionally with gulp-if (or something else)

Basically I want to setup my task so that if I do gulp less --watch it will watch, otherwise just do the build. This is what I have so far: 'use strict'; var gulp = require('gulp'); var less = require('gulp-less'); var gulpif =…
knownasilya
  • 5,998
  • 4
  • 36
  • 59
4
votes
1 answer

Creating .js, .min.js and .js.map file with gulp?

I am trying to utilize gulp 3.9 to minify my resource files. I created a two different tasks in my gulpfile that looks like this var gulp = require("gulp"), concat = require("gulp-concat"), cssmin = require("gulp-cssmin"), filter =…
Junior
  • 11,602
  • 27
  • 106
  • 212