diff options
author | spf13 <[email protected]> | 2014-05-28 19:01:24 -0400 |
---|---|---|
committer | spf13 <[email protected]> | 2014-05-28 19:01:24 -0400 |
commit | 7a8b754cada398241fc2d58d63ce58551f6c734c (patch) | |
tree | db8d844f25cb462db3202b8b53d8433bde6bb4b7 /transform | |
parent | 4076d77029e0705f9e9aa43a347b033dbc2d3cc9 (diff) | |
download | hugo-7a8b754cada398241fc2d58d63ce58551f6c734c.tar.gz hugo-7a8b754cada398241fc2d58d63ce58551f6c734c.zip |
Fixed #301. LiveReload works on any port now.
Diffstat (limited to 'transform')
-rw-r--r-- | transform/livereloadinject.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/transform/livereloadinject.go b/transform/livereloadinject.go index a84f850ad..0973841b3 100644 --- a/transform/livereloadinject.go +++ b/transform/livereloadinject.go @@ -1,12 +1,17 @@ package transform -import "bytes" +import ( + "bytes" + + "github.com/spf13/viper" +) func LiveReloadInject(content []byte) []byte { match := []byte("</body>") + port := viper.GetString("port") replace := []byte(`<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] - + ':1313/livereload.js?mindelay=10"></' + + ':` + port + `/livereload.js?mindelay=10"></' + 'script>')</script></body>`) newcontent := bytes.Replace(content, match, replace, -1) |