diff options
author | Kato Kazuyoshi <kato.kazuyoshi@gmail.com> | 2015-10-14 00:41:54 -0700 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2015-10-15 16:36:13 -0400 |
commit | ef4dfcec6cf17308e2816ef29801f01c3cf6fcbb (patch) | |
tree | f77d852097ef07e0775b515a52f7fe21b51b5725 /transform/livereloadinject.go | |
parent | 0f438d185272f9c14b8aa64dd0cb2d0cef260361 (diff) |
Load livereload.js from "/"
Fix #1406
Instead of loading the file from http://localhost:port/, it can be
loaded from /.
Diffstat (limited to 'transform/livereloadinject.go')
-rw-r--r-- | transform/livereloadinject.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/transform/livereloadinject.go b/transform/livereloadinject.go index 38e4e8cc9..2fb130c17 100644 --- a/transform/livereloadinject.go +++ b/transform/livereloadinject.go @@ -2,18 +2,13 @@ package transform import ( "bytes" - "github.com/spf13/viper" ) func LiveReloadInject(ct contentTransformer) { match := []byte("</body>") - port := viper.GetString("port") - replace := []byte(`<script data-no-instant>document.write('<script src="http://' - + (location.host || 'localhost').split(':')[0] - + ':` + port + `/livereload.js?mindelay=10"></' - + 'script>')</script></body>`) - newcontent := bytes.Replace(ct.Content(), match, replace, -1) + replace := []byte(`<script data-no-instant>document.write('<script src="/livereload.js?mindelay=10"></' + 'script>')</script></body>`) + newcontent := bytes.Replace(ct.Content(), match, replace, -1) if len(newcontent) == len(ct.Content()) { match := []byte("</BODY>") newcontent = bytes.Replace(ct.Content(), match, replace, -1) |