wiper
v1.3.0
Published
A command line tool that gaze at your file changes and do a tiny-lr when needed
Downloads
35
Readme
wiper
A command line tool that watch file changes and do a livereload when needed (compatible with both node.js and io.js), and works over https.
Motivation
This allows us to use npm
as our build tool instead of grunt
or gulp
.
Install
npm install wiper --save-dev
or npm install -g wiper
Usage
In your package.json
, add these lines.
{
"scripts": {
"watch": "DEBUG=wiper wiper -p 1234 -t 2000 -w \\*\\*/\\*.js,\\*\\*/\\*.css"
}
}
Now try npm run watch
, a livereload server will be running at localhost:1234
and watching updates to javascript/css files.
Options
-p
port to listen on, default to 35729.-t
debounce timeout, default to 5000ms.-w
files to watch; note that you should use\*
to prevent bash from expanding globs, as we want wiper to expand it instead, also see that we double escape\\*
in package.json due to additional string escapes.--cert=ssl.crt
and--key=ssl.key
to start livereload server on https, generate your self-signed certificate and import them into your CA trust store for this to work.
Integration
To integrate with your koa/express server, use modules like koa-livereload or connect-livereload.
// for http
app.use(livereload({
port: 1234
}));
// for https
app.use(livereload({
src: 'https://example.com:1234/livereload.js?snipver=1'
}));
Or manually insert this line onto your template.
<script src="http://localhost:1234/livereload.js?snipver=1"></script>
Now your browsers will be refreshed automatically when file change occurs. And see, no grunt
or gulp
needed, just good-old npm
.
License
MIT