Total Pageviews

Friday, 1 July 2016

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.
from https://github.com/bitinn/wiper