@skivvy/skivvy-package-watch

Watch files and folders for changes

Usage no npm install needed!

<script type="module">
  import skivvySkivvyPackageWatch from 'https://cdn.skypack.dev/@skivvy/skivvy-package-watch';
</script>

README

Skivvy package: watch

npm version Stability Build Status

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 the task option to Skivvy's api.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