james-reload

0.5.4 • Public • Published

James-reload

Browser reload plugin for James.js

Requirements

  • Node.js
  • NPM

Installation

npm install -g james-reload

Binary

jreload -s <source port> -p <port to proxy to> -w <list of globs to watch>

Example

jreload -s 9001 -p 9002 -w js/**/*.js,js/**/*.hbs

More information

jreload --help

API

Basic configuration

var reloadFactory = require('james-reload');
var reload = reloadFactory({
  srcPort: 80,
  proxyPort: 9002
});

Reads content from port 80 and proxies it to port 9002 with the client side script appended

Example usage

var reloadFactory = require('james-reload');
var reload = reloadFactory({
  srcPort: 80,
  proxyPort: 9002
});
 
setTimeout(function() {
  reload();
}, 5000)
 

Reloads your browsers location after 5 seconds.


reloadFactory(config)

Returns a function reload for sending a signal when client should reload content

config (Object)

  • srcPort: (Number)
    • Port to read from
    • Default: 9001
  • proxyPort: (Number)
    • Proxy where the content is proxied
    • Default: 9002
  • keepReconnecting (Boolean)
    • Try reconnection if proxy request fails
    • Default: true
  • reloadAfterReconnect
    • Reload client location when websocket connection disconnects and connects again
    • Default: true
  • debug
    • console.log errors and info messages
    • Default: false

reload(config)

signals client script to reload content

config (Object)

  • stylesheetsOnly: (Boolean)
    • Tell client script to only reload stylesheet files if set to true
    • Default: false

Readme

Keywords

none

Package Sidebar

Install

npm i james-reload

Weekly Downloads

2

Version

0.5.4

License

BSD

Last publish

Collaborators

  • riku