Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to current hostname instead of localhost #9

Closed
wants to merge 1 commit into from

Conversation

buschtoens
Copy link
Contributor

If process.env.EMBER_CLI_INJECT_LIVE_RELOAD_HOST this script will be injected, which takes the current hostname of the page and uses it for serving livereload.js.

<script type="text/javascript">
  (function(d, l, p, s) {
    s = d.createElement("script");
    s.type = "text/javascript";
    s.async = true;
    s.src = l.protocol + "//"
      + l.hostname     + ":"
      + p
      + "/livereload.js?snipver=1";

    d.getElementsByTagName("head")[0].appendChild(s);
  })(document, document.location, 12345);
</script>

If `process.env.EMBER_CLI_INJECT_LIVE_RELOAD_HOST` this script will be injected, which takes the current hostname of the page and uses it for serving `livereload.js`.

```js
<script type="text/javascript">
  (function(d, l, p, s) {
    s = d.createElement("script");
    s.type = "text/javascript";
    s.async = true;
    s.src = l.protocol + "//"
      + l.hostname     + ":"
      + p
      + "/livereload.js?snipver=1";

    d.getElementsByTagName("head")[0].appendChild(s);
  })(document, document.location, 12345);
</script>
```
@buschtoens
Copy link
Contributor Author

Please note that this is untested yet. I'm waiting for npm to finish updating, so I can test it.

@buschtoens
Copy link
Contributor Author

Works like a charm. ❤️

@buschtoens
Copy link
Contributor Author

This kinda renders #5 obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant