mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-23 00:23:06 +00:00
LiveReloadDisabled works with Watching properly. Fixed #335.
This commit is contained in:
parent
1b5f59b071
commit
4281cbfa34
1 changed files with 9 additions and 3 deletions
|
@ -308,7 +308,7 @@ func NewWatcher(port int) error {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case evs := <-watcher.Event:
|
case evs := <-watcher.Event:
|
||||||
jww.INFO.Println(evs)
|
jww.INFO.Println("File System Event:", evs)
|
||||||
|
|
||||||
static_changed := false
|
static_changed := false
|
||||||
dynamic_changed := false
|
dynamic_changed := false
|
||||||
|
@ -340,14 +340,20 @@ func NewWatcher(port int) error {
|
||||||
fmt.Print("Static file changed, syncing\n\n")
|
fmt.Print("Static file changed, syncing\n\n")
|
||||||
utils.StopOnErr(copyStatic(), fmt.Sprintf("Error copying static files to %s", helpers.AbsPathify(viper.GetString("PublishDir"))))
|
utils.StopOnErr(copyStatic(), fmt.Sprintf("Error copying static files to %s", helpers.AbsPathify(viper.GetString("PublishDir"))))
|
||||||
|
|
||||||
livereload.ForceRefresh()
|
if !viper.GetBool("DisableLiveReload") {
|
||||||
|
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initalized
|
||||||
|
livereload.ForceRefresh()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if dynamic_changed {
|
if dynamic_changed {
|
||||||
fmt.Print("Change detected, rebuilding site\n\n")
|
fmt.Print("Change detected, rebuilding site\n\n")
|
||||||
utils.StopOnErr(buildSite(true))
|
utils.StopOnErr(buildSite(true))
|
||||||
|
|
||||||
livereload.ForceRefresh()
|
if !viper.GetBool("DisableLiveReload") {
|
||||||
|
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initalized
|
||||||
|
livereload.ForceRefresh()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case err := <-watcher.Error:
|
case err := <-watcher.Error:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue