1 | # James-reload
|
2 | Browser reload plugin for [James.js](https://github.com/leonidas/james.js)
|
3 |
|
4 | ## Requirements
|
5 | * Node.js
|
6 | * NPM
|
7 |
|
8 | ## Installation
|
9 | npm install -g james-reload
|
10 |
|
11 | ## Binary
|
12 | jreload -s <source port> -p <port to proxy to> -w <list of globs to watch>
|
13 | Example
|
14 |
|
15 | jreload -s 9001 -p 9002 -w js/**/*.js,js/**/*.hbs
|
16 |
|
17 | More information
|
18 |
|
19 | jreload --help
|
20 |
|
21 |
|
22 | ## API
|
23 | __Basic configuration__
|
24 | ```javascript
|
25 | var reloadFactory = require('james-reload');
|
26 | var reload = reloadFactory({
|
27 | srcPort: 80,
|
28 | proxyPort: 9002
|
29 | });
|
30 | ```
|
31 | Reads content from port __80__ and proxies it to port __9002__ with the client side script appended
|
32 |
|
33 | __Example usage__
|
34 | ```javascript
|
35 | var reloadFactory = require('james-reload');
|
36 | var reload = reloadFactory({
|
37 | srcPort: 80,
|
38 | proxyPort: 9002
|
39 | });
|
40 |
|
41 | setTimeout(function() {
|
42 | reload();
|
43 | }, 5000)
|
44 |
|
45 | ```
|
46 |
|
47 | Reloads your browsers location after 5 seconds.
|
48 |
|
49 | ---
|
50 |
|
51 | ## reloadFactory(config)
|
52 | Returns a function [reload](#reload) for sending a signal when client should reload content
|
53 | ####config (Object)
|
54 | * srcPort: (Number)
|
55 | * Port to read from
|
56 | * Default: __9001__
|
57 | * proxyPort: (Number)
|
58 | * Proxy where the content is proxied
|
59 | * Default: __9002__
|
60 | * keepReconnecting (Boolean)
|
61 | * Try reconnection if proxy request fails
|
62 | * Default: __true__
|
63 | * reloadAfterReconnect
|
64 | * Reload client location when websocket connection disconnects and connects again
|
65 | * Default: __true__
|
66 | * debug
|
67 | * console.log errors and info messages
|
68 | * Default: __false__
|
69 |
|
70 | # reload(config)
|
71 | signals client script to reload content
|
72 | ####config (Object)
|
73 | * stylesheetsOnly: (Boolean)
|
74 | * Tell client script to only reload stylesheet files if set to true
|
75 | * Default: __false__
|