shithub: hugo

Download patch

ref: 4281cbfa34f879954c021dd81616daf0879bc7a7
parent: 1b5f59b071bfe7dd66b02a900fbd78296d7baf81
author: spf13 <[email protected]>
date: Mon Aug 25 09:49:53 EDT 2014

LiveReloadDisabled works with Watching properly. Fixed #335.

--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -308,7 +308,7 @@
 		for {
 			select {
 			case evs := <-watcher.Event:
-				jww.INFO.Println(evs)
+				jww.INFO.Println("File System Event:", evs)
 
 				static_changed := false
 				dynamic_changed := false
@@ -340,7 +340,10 @@
 					fmt.Print("Static file changed, syncing\n\n")
 					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 {
@@ -347,7 +350,10 @@
 					fmt.Print("Change detected, rebuilding site\n\n")
 					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:
 				if err != nil {