diff options
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) |