UNPKG

2.31 kBMarkdownView Raw
1# ember-cli-inject-live-reload
2
3Plugin for ember-cli that injects live-reload script into HTML content.
4
5## Overview
6
7This plugin injects a script tag to load `ember-cli-live-reload.js` in the head of your application's html.
8
9The contents of `ember-cli-live-reload.js` are dynamically generated to configure and inject `livereload.js`, which is served by Ember CLI courtesy of its `tiny-lr` dependency.
10
11`livereload.js` initiates a websocket connection back to Ember CLI. This allows Ember CLI to notify the browser to trigger a refresh after JavaScript or style changes.
12
13## Configuration
14
15For vanilla Ember CLI apps, no configuration is required.
16
17The following options are supported via command line arguments or the `.ember-cli` file:
18
19|Option|Purpose|
20|------|-------|
21| `liveReload` | Defaults to `true` during `ember serve`. Set to `false` to prevent the livereload script tag from being injected. |
22| `liveReloadPort` | Specifies the port that `ember-cli-live-reload.js` and `livereload.js` are loaded from |
23| `liveReloadHost` | The host that `ember-cli-live-reload.js` will be loaded from |
24| `liveReloadPrefix` | The url prefix which will be prepended before `livereload.js` |
25
26The following options are supported via the `.ember-cli` file:
27
28|Option|Purpose|
29|------|-------|
30| `liveReloadJsUrl` | The absolute URL used to load `livereload.js`. If specified, this overrides the `liveReloadPort` option. |
31| `liveReloadOptions` | JavaScript object for LiveReload options. LiveReload supports a number of [options](https://github.com/livereload/livereload-js#options) for configuring websocket communication, including `https`, `host`, `port`, and others. See advanced example below. |
32
33## Advanced Example Configuration
34
35**NOTE:** Most apps will be fine with _no_ special configuration. Only use this sort of configuration if you have reason to override the default LiveReload websocket behavior. A use case for this is serving Ember CLI apps in development via a reverse proxy such as nginx.
36
37##### .ember-cli
38
39```javascript
40{
41 "liveReloadPort": 37531,
42
43 // This `liveReloadOptions` property becomes `window.LiveReloadOptions`
44 "liveReloadOptions": {
45 "port": 37631,
46 "https": true,
47 "host": "your-hostname.dev"
48 },
49
50 "liveReloadJsUrl": "https://your-hostname.dev/livereload.js"
51}
52```