diff --git a/commands/server.go b/commands/server.go index 7f0b9585e..89e4c5ba7 100644 --- a/commands/server.go +++ b/commands/server.go @@ -83,6 +83,8 @@ func server(cmd *cobra.Command, args []string) { serverPort = sp.Port } + viper.Set("port", serverPort) + if serverAppend { viper.Set("BaseUrl", strings.TrimSuffix(BaseUrl, "/")+":"+strconv.Itoa(serverPort)) } else { diff --git a/transform/livereloadinject.go b/transform/livereloadinject.go index a84f850ad..0973841b3 100644 --- a/transform/livereloadinject.go +++ b/transform/livereloadinject.go @@ -1,12 +1,17 @@ package transform -import "bytes" +import ( + "bytes" + + "github.com/spf13/viper" +) func LiveReloadInject(content []byte) []byte { match := []byte("") + port := viper.GetString("port") replace := []byte(``) newcontent := bytes.Replace(content, match, replace, -1)