watch
Skivvy package:
Watch files and folders for changes
Installation
skivvy install watch
Overview
This package allows you to watch files and folders for changes from within the Skivvy task runner.
Included tasks
watch
Watch files and folders using chokidar, and run Skivvy tasks when files are changed.
Usage:
skivvy run watch
Configuration settings:
Name | Type | Required | Default | Description |
---|---|---|---|---|
files |
string Array<string>
|
Yes | N/A | Files and folders to watch (can contain globs) |
task |
string object function Array<string,object,function>
|
Yes | N/A | Skivvy task(s) to run when files are changed |
debounce |
number |
No | 0 |
Batch multiple changes that occur within debounce milliseconds of each other |
events |
Array<string> |
No | ["add", "change", "unlink"] |
Chokidar events to listen for |
options |
object |
No | null |
Chokidar options |
Notes:
-
The
task
configuration setting will be passed directly as thetask
option to Skivvy'sapi.run()
method.This means that the following examples are all valid values for the
task
configuration setting:"my-local-task"
"my-local-task:custom-target"
"my-package::external-task"
"my-package::external-task:custom-target"
{ "task": "my-local-task", "config": { "foo": "bar" } }
{ "task": "my-package::external-task", "config": { "foo": "bar" } }
[ "my-local-task", "my-package::external-task:custom-target", { "task": "my-local-task", "config": { "foo": "bar" } }, { "task": "my-package::external-task", "config": { "foo": "bar" } } ]
Returns:
Watcher
Chokidar instance, returned from chokidar.watch