Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/stagas/watch-js

watch clone in node.js
https://github.com/stagas/watch-js

Last synced: 13 days ago
JSON representation

watch clone in node.js

Awesome Lists containing this project

README

        

# watch-js

```
Usage: watch [options]

Options:

-h, --help output usage information
-V, --version output the version number
-m, --match Only report changes when filename matches glob.
-i, --interval Run on an interval of seconds.
-b, --before Command to run before monitoring starts.
-r, --running Monitor long-running process.
-v, --verbose Be verbose.
-l, --live Live reload.
-d, --delay Time in ms to delay updates.
-w, --watch Watch for changes on dir.
```

## Examples

Runs `make` when a file changes:

```sh
$ watch make
```

Runs `make` before monitoring __(-b)__, then runs `node server`, a long-running process __(-r)__:

```sh
$ watch -rb make node server
```

Runs `make` then reloads __(-l)__ browser when files of type `.js` or `.css` change __(-m)__:

```sh
$ watch -lm *.{js,css} make
```

The above method requires this script tag:

```html

```

If you use [Components](https://github.com/component/component/wiki/Components)
you can add it in like this:

```js
"development": {
"stagas/watch-js": "*"
}
```

Then you can do `require('stagas-watch-js')` in your development files.

Now, in conjunction with `watch -l make`, when you save a file in your editor it will run `make` and reload your browser automatically.

Combinations possible:

```sh
$ watch -lrb "make clean build" node server
```

## License

MIT