Use --baseURL path for live-reload URL

Fixes #6595
This commit is contained in:
sth
2020-12-02 12:52:26 +01:00
committed by GitHub
parent aebfe156fb
commit 0ad378b09c
6 changed files with 42 additions and 14 deletions

View File

@@ -16,6 +16,7 @@ package commands
import (
"bytes"
"io"
"net/url"
"github.com/gohugoio/hugo/transform"
"github.com/gohugoio/hugo/transform/livereloadinject"
@@ -82,9 +83,9 @@ var buildErrorTemplate = `<!doctype html>
</html>
`
func injectLiveReloadScript(src io.Reader, port int) string {
func injectLiveReloadScript(src io.Reader, baseURL url.URL) string {
var b bytes.Buffer
chain := transform.Chain{livereloadinject.New(port)}
chain := transform.Chain{livereloadinject.New(baseURL)}
chain.Apply(&b, src)
return b.String()