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.
$ npm install -g gazer
$ gazer --pattern "readme.md" echo "blorp"
[readme.md changes]
> "blorp"
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
to run a build task every time a file
changes:
{
"scripts": {
"build-less": "lessc public/less/main.less public/css/main.css",
"watch-less": "gazer -p 'public/less/**/*.less' npm run build-less"
}
}
And then start the watcher:
$ npm run watch-less