gulp-watch5.0.1 • Public • Published
File watcher that uses super-fast chokidar and emits vinyl objects.
npm install --save-dev gulp-watch
var gulp =watch = ;gulp;gulp;
Protip: until gulpjs 4.0 is released, you can use gulp-plumber to prevent stops on errors.
More examples can be found in
watch(glob, [options, callback])
Creates a watcher that will spy on files that are matched by
glob which can be a
glob string or array of glob strings.
Returns a pass through stream that will emit vinyl files
event property) that corresponds to event on file-system.
This function is called when events happen on the file-system.
All incoming files that are piped in are grouped and passed to the
events stream as is.
vinyl— is vinyl object that corresponds to the file that caused the 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 is present in options, you will get more readable output.
This option will enable verbose output.
readDelay milliseconds before reading the file.
Setting this to
false will return
file.contents as null and not read the file at all. Most useful as an optimization if your plugins pipeline doesn't make use of the file contents (e.g.
gulp-clean), or to avoid reading the file twice if you use
gulp.src() inside the callback instead of the file object that is passed as argument.
Stream from constructor has some useful methods:
add(path / paths)
unwatch(path / paths)
All events from chokidar:
MIT (c) 2014 Vsevolod Strukchinsky (firstname.lastname@example.org)