mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Watching doesn't built site 2x on write (ignores rename events). Also ignores temporary files written by editors.
This commit is contained in:
parent
a5606b06ca
commit
cd71eb7389
1 changed files with 7 additions and 2 deletions
|
@ -181,7 +181,12 @@ func watchChange(ev *fsnotify.FileEvent) {
|
||||||
fmt.Println("Static file changed, syncing\n")
|
fmt.Println("Static file changed, syncing\n")
|
||||||
utils.CheckErr(copyStatic(), fmt.Sprintf("Error copying static files to %s", Config.GetAbsPath(Config.PublishDir)))
|
utils.CheckErr(copyStatic(), fmt.Sprintf("Error copying static files to %s", Config.GetAbsPath(Config.PublishDir)))
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Change detected, rebuilding site\n")
|
if !ev.IsRename() { // Rename is always accompanied by a create or modify
|
||||||
utils.StopOnErr(buildSite())
|
// Ignoring temp files created by editors (vim)
|
||||||
|
if !strings.HasSuffix(ev.Name, "~") && !strings.HasSuffix(ev.Name, ".swp") {
|
||||||
|
fmt.Println("Change detected, rebuilding site\n")
|
||||||
|
utils.StopOnErr(buildSite())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue