mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
Load livereload.js from "/"
Fix #1406 Instead of loading the file from http://localhost:port/, it can be loaded from /.
This commit is contained in:
parent
0f438d1852
commit
ef4dfcec6c
2 changed files with 22 additions and 7 deletions
20
transform/livereloadinject_test.go
Normal file
20
transform/livereloadinject_test.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package transform
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/spf13/hugo/helpers"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLiveReloadInject(t *testing.T) {
|
||||
out := new(bytes.Buffer)
|
||||
in := helpers.StringToReader("</body>")
|
||||
|
||||
tr := NewChain(LiveReloadInject)
|
||||
tr.Apply(out, in, []byte("path"))
|
||||
|
||||
expected := `<script data-no-instant>document.write('<script src="/livereload.js?mindelay=10"></' + 'script>')</script></body>`
|
||||
if string(out.Bytes()) != expected {
|
||||
t.Errorf("Expected %s got %s", expected, string(out.Bytes()))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue