1
Fork 0

update docs

This commit is contained in:
Conduitry 2018-01-31 09:56:40 -05:00
parent e93bc8540e
commit 1712cf7289
2 changed files with 9 additions and 11 deletions

16
API.md
View file

@ -58,13 +58,13 @@ A sorted array of the relative paths of all of the physical files. This can be u
## Configuration
### `add({ gaze, rootPath, read = true })`
### `add({ chokidar, rootPath, read = true })`
Register a Gaze instance.
Register a Chokidar watch.
- `gaze` - the Gaze instance
- `chokidar` - the Chokidar watch
- `rootPath` - the path that all of our paths should be relative to
- `read` - _(optional)_ whether to actually read in the contents of the files for this Gaze. If `false`, the files will still be run through all of the transforms, but they will have null `bytes` and `text`
- `read` - _(optional)_ whether to actually read in the contents of the files for this Chokidar watch. If `false`, the files will still be run through all of the transforms, but they will have null `bytes` and `text`
Returns the `Defiler` instance for chaining.
@ -90,9 +90,9 @@ Returns the `Defiler` instance for chaining.
### `exec({ close = false })`
Starts the Defiler running. No additional configuration (registering Gazes, transforms, or generated files) can happen after this.
Start the Defiler running. No additional configuration (registering Chokidar watches, transforms, or generated files) can happen after this.
- `close` - _(optional)_ whether to immediately close all of the attached Gazes after the initial wave of processing
- `close` - _(optional)_ whether to immediately close all of the attached Chokidar watches after the initial wave of processing
Returns the `Defiler` instance for chaining.
@ -100,7 +100,7 @@ Returns the `Defiler` instance for chaining.
### `get(path, dependent)`
Waits for a file or array of files to be ready.
Wait for a file or array of files to be ready, and retrieve the `File` instance(s).
- `path` - the path, or array of paths, to wait for to become available
- `dependent` - _(optional)_ a path of a file to re-process if any of the file or files given in `path` change. Typically, this is the path to the file you are currently transforming or generating
@ -131,7 +131,7 @@ Returns a `Promise` to indicate when all processing is complete.
### `close()`
Close all of the attached Gazes.
Close all of the attached Chokidar watches.
## Events

View file

@ -20,8 +20,6 @@ Files can be made to depend on other files, so that changes to a dependency caus
Any transform or generator can also create additional files (which will then be run through all of the transforms). There's currently no way to make this additional file depend on any others for the purposes of automatic re-transformation, as the file would generally just be re-added when that transform or generator is run again.
Gaze is used as the underlying watcher for the simple reason that it provided an easy way to get a list of all of the currently watched files, so I didn't have to traverse the directory's initial contents at the start of the build.
If you need to write the transformed files to disk, that's its own transform. Just leave the file object untouched but write the file to disk in the appropriate location and return a promise indicating when you're done.
If you need some task management, that's outside the scope of this library. Just use `await` and `Promise.all`.
@ -29,7 +27,7 @@ If you need some task management, that's outside the scope of this library. Just
## Requirements
- [Node.js](https://nodejs.org/) 7.6+, as this code uses `async` / `await` extensively.
- [Gaze](https://www.npmjs.com/package/gaze)
- [Chokidar](https://www.npmjs.com/package/chokidar)
- Insanity
## Documentation