Watch, that actually is an endless stream
File watcher, that uses super-fast chokidar and emits vinyl objects.
npm install gulp-watch.
var gulp = require'gulp'watch = require'gulp-watch';gulptask'default'gulpsrc'css/**/*.css'pipewatch'css/**/*.css'pipegulpdest'./build/';;
Protip: until gulpjs 4.0 is released, you can use gulp-plumber to prevent stops on errors.
More examples can be found in
Creates watcher that will spy on files that were matched by
glob which can be a
node-glob string or array of strings.
Returns pass through stream, that will emit vinyl files
event property) that corresponds to event on file-system.
This function is called, when some events is happens on file-system.
All incoming files that piped in will be grouped and passed to
events stream as is.
vinyl— is vinyl object that corresponds to file that caused event. Additional
eventfield is added to determine what caused changes.
add- file was added to watch or created
change- file was changed
unlink- file was deleted
Indicates whether chokidar should ignore the initial add events or not.
['add', 'change', 'unlink']
List of events, that should be watched by gulp-watch. Contains event names from chokidar.
Use explicit base path for files from
glob. Read more about
cwd in gulpjs docs.
Name of the watcher. If it present in options, you will get more readable output.
This options will enable verbose output.
Stream from constructor have some useful methods:
add(path / paths)
unwatch(path / paths)
MIT (c) 2014 Vsevolod Strukchinsky (email@example.com)