Watch some files, do a thing
A simple wrapper for Shama's gaze module that performs an arbitrary command when files change. Like watchify, but for everything.
Installation
$ npm install gazer-color
Usage
$ gazer-color --pattern README.md -- echo blorp# note the -- between the gazer-color arguments like --patern and the command and its arguments [README.md changes] > blorp
Multiple patterns
gaze accepts an array of patterns, so does gazer-color
:
$ gazer-color --pattern '**/*.js' --pattern '!node_modules/**/*' -- echo blorp [index.js changes] > blorp
Arbitrary watch tasks with npm run
If you haven't read substack's post describing lightweight build steps
with npm run
, I'll
give you a moment to get up to speed.
Here's how you might use gazer-color
to run a build task every time a file
changes:
"scripts": "test": "mocha" "watch-test": "gazer-color -p \"public/less/**/*.less\" -- npm run test"
And then start the watcher:
$ npm run watch-less