1.1.2 • Published 2 years ago

browserify-reload-fork v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

browserify-reload is a browserify plugin that reload your client side bundle everytime it gets updated (e.g. through watchify)

Version License

Motivation

I really cannot rely on express interceptor / proxy or whatever, browserify-reload provides the slimest overhead to reach an interactive client / server sync & reload.

It use tiny WS server (listening on random port) and inject, through browserify-wrap a tiny boostrap prefix on your browserify bundle so it listen for a "reload" event.

For convenience, you can also register additionnal file paths to be watched (once modified, they'll also trigger the client reload signal).

API

const reload = require('browserify-reload');

var b = bundle();
b.plugin(reload [, opts])

b.bundle().pipe(somewhere);

Options

  • { deferred : false } Do not signal the client to reload once the bundle stream ends (so you might apply additionnal, non browserify-compliant processing afterwards BEFORE notifying the client), see opts.xfiles

  • { xfiles : file_path1, file_path2 } Monitor file paths and trigger client reload signal every time they are modified.

  • { host : (default document.location.hostname) } WS notification host the browser will connect to

Credits

Keywords / shout box

browserify, prefix, suffix, wrapper, plugin, browserify-plugin