From: Bjørn Erik Pedersen Date: Fri, 31 Jan 2020 07:15:22 +0000 (+0100) Subject: transform/livereloadinject: Add defer to livereload script tag X-Git-Tag: v0.64.0~8 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b3f0674b80a32425aeb4412f318c720391bbf773;p=brevno-suite%2Fhugo transform/livereloadinject: Add defer to livereload script tag In #6821 we moved the loading from end of body to head to make Turbolinks and similar work. This commit adds a defer attribute to avoid page parse blocking. --- diff --git a/transform/livereloadinject/livereloadinject.go b/transform/livereloadinject/livereloadinject.go index 896dcab4..bbafdff7 100644 --- a/transform/livereloadinject/livereloadinject.go +++ b/transform/livereloadinject/livereloadinject.go @@ -59,7 +59,7 @@ func New(port int) transform.Transformer { return err } - script := []byte(fmt.Sprintf(``, port)) + script := []byte(fmt.Sprintf(``, port)) i := idx if match.appendScript { diff --git a/transform/livereloadinject/livereloadinject_test.go b/transform/livereloadinject/livereloadinject_test.go index ea1b3aa6..690db31c 100644 --- a/transform/livereloadinject/livereloadinject_test.go +++ b/transform/livereloadinject/livereloadinject_test.go @@ -25,7 +25,7 @@ import ( func TestLiveReloadInject(t *testing.T) { c := qt.New(t) - expectBase := `` + expectBase := `` apply := func(s string) string { out := new(bytes.Buffer) in := strings.NewReader(s)