diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-02-06 19:22:12 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-02-06 19:22:12 +0100 |
commit | 08b582e18730d44111203e28e761c5c7c07062bf (patch) | |
tree | f94ff90fcff28c1434e26c3a032a1f3a749ea0ff | |
parent | dd1db334ac15f3bdb67b40973668d1d7b9ca7f08 (diff) |
Only do one livereload replacement
-rw-r--r-- | transform/livereloadinject.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/transform/livereloadinject.go b/transform/livereloadinject.go index 9eab45f78..bd22901df 100644 --- a/transform/livereloadinject.go +++ b/transform/livereloadinject.go @@ -24,12 +24,12 @@ func LiveReloadInject(ct contentTransformer) { replaceTemplate := `<script data-no-instant>document.write('<script src="/livereload.js?mindelay=10"></' + 'script>')</script>%s` replace := []byte(fmt.Sprintf(replaceTemplate, endBodyTag)) - newcontent := bytes.Replace(ct.Content(), match, replace, -1) + newcontent := bytes.Replace(ct.Content(), match, replace, 1) if len(newcontent) == len(ct.Content()) { endBodyTag = "</BODY>" replace := []byte(fmt.Sprintf(replaceTemplate, endBodyTag)) match := []byte(endBodyTag) - newcontent = bytes.Replace(ct.Content(), match, replace, -1) + newcontent = bytes.Replace(ct.Content(), match, replace, 1) } ct.Write(newcontent) |