mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-23 14:12:57 +00:00
Only do one livereload replacement
This commit is contained in:
parent
dd1db334ac
commit
08b582e187
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue