mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Re-instate disableLiveReload as a config option (and not just a flag)
Closes #11259
This commit is contained in:
parent
2f11e673c5
commit
f1a061e9ed
5 changed files with 56 additions and 14 deletions
|
@ -89,7 +89,6 @@ func flagsToCfgWithAdditionalConfigBase(cd *simplecobra.Commandeer, cfg config.P
|
||||||
"quiet": true,
|
"quiet": true,
|
||||||
"verbose": true,
|
"verbose": true,
|
||||||
"watch": true,
|
"watch": true,
|
||||||
"disableLiveReload": true,
|
|
||||||
"liveReloadPort": true,
|
"liveReloadPort": true,
|
||||||
"renderToMemory": true,
|
"renderToMemory": true,
|
||||||
"clock": true,
|
"clock": true,
|
||||||
|
|
|
@ -61,7 +61,6 @@ type InternalConfig struct {
|
||||||
Verbose bool
|
Verbose bool
|
||||||
Clock string
|
Clock string
|
||||||
Watch bool
|
Watch bool
|
||||||
DisableLiveReload bool
|
|
||||||
LiveReloadPort int
|
LiveReloadPort int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,6 +453,9 @@ type RootConfig struct {
|
||||||
// Disable the injection of the Hugo generator tag on the home page.
|
// Disable the injection of the Hugo generator tag on the home page.
|
||||||
DisableHugoGeneratorInject bool
|
DisableHugoGeneratorInject bool
|
||||||
|
|
||||||
|
// Disable live reloading in server mode.
|
||||||
|
DisableLiveReload bool
|
||||||
|
|
||||||
// Enable replacement in Pages' Content of Emoji shortcodes with their equivalent Unicode characters.
|
// Enable replacement in Pages' Content of Emoji shortcodes with their equivalent Unicode characters.
|
||||||
// <docsmeta>{"identifiers": ["Content", "Unicode"] }</docsmeta>
|
// <docsmeta>{"identifiers": ["Content", "Unicode"] }</docsmeta>
|
||||||
EnableEmoji bool
|
EnableEmoji bool
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ func (s *Site) renderAndWritePage(statCounter *uint64, name string, targetPath s
|
||||||
pd.AbsURLPath = s.absURLPath(targetPath)
|
pd.AbsURLPath = s.absURLPath(targetPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.watching() && s.conf.Internal.Running && !s.conf.Internal.DisableLiveReload {
|
if s.watching() && s.conf.Internal.Running && !s.conf.DisableLiveReload {
|
||||||
pd.LiveReloadBaseURL = s.Conf.BaseURLLiveReload().URL()
|
pd.LiveReloadBaseURL = s.Conf.BaseURLLiveReload().URL()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
testscripts/commands/server_disablelivereload.txt
Normal file
20
testscripts/commands/server_disablelivereload.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
hugo server --renderToDisk --disableLiveReload &
|
||||||
|
|
||||||
|
waitServer
|
||||||
|
|
||||||
|
! grep 'livereload' public/index.html
|
||||||
|
|
||||||
|
stopServer
|
||||||
|
! stderr .
|
||||||
|
|
||||||
|
-- hugo.toml --
|
||||||
|
baseURL = "http://example.org/"
|
||||||
|
disableKinds = ["RSS", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
|
||||||
|
-- layouts/index.html --
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Home.
|
||||||
|
</body>
|
||||||
|
</html>
|
21
testscripts/commands/server_disablelivereload__config.txt
Normal file
21
testscripts/commands/server_disablelivereload__config.txt
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
hugo server --renderToDisk &
|
||||||
|
|
||||||
|
waitServer
|
||||||
|
|
||||||
|
! grep 'livereload' public/index.html
|
||||||
|
|
||||||
|
stopServer
|
||||||
|
! stderr .
|
||||||
|
|
||||||
|
-- hugo.toml --
|
||||||
|
baseURL = "http://example.org/"
|
||||||
|
disableKinds = ["RSS", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
|
||||||
|
disableLiveReload = true
|
||||||
|
-- layouts/index.html --
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Home.
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue