diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-03-10 18:12:11 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-03-11 14:13:03 +0100 |
commit | df298558a5a5b747288d9656402af85e0ac75a43 (patch) | |
tree | ed62ce971aeead7cf1833a8e9310dd69cbaa565f /commands/hugo.go | |
parent | b1106f8715cac3544b8ea662b969336fe56fa047 (diff) |
Improve Tailwind/PostCSS error messages
Fixes #7041
Fixes #7042
Diffstat (limited to 'commands/hugo.go')
-rw-r--r-- | commands/hugo.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/commands/hugo.go b/commands/hugo.go index 4f7faaae4..841318685 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -722,9 +722,6 @@ func (c *commandeer) handleBuildErr(err error, msg string) { func (c *commandeer) rebuildSites(events []fsnotify.Event) error { defer c.timeTrack(time.Now(), "Total") - defer func() { - c.wasError = false - }() c.buildErr = nil visited := c.visitedURLs.PeekAllSet() @@ -886,6 +883,10 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher, evs []fsnotify.Event, configSet map[string]bool) { + defer func() { + c.wasError = false + }() + var isHandled bool for _, ev := range evs { @@ -1080,10 +1081,11 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher, // Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized // force refresh when more than one file - if len(staticEvents) == 1 { + if !c.wasError && len(staticEvents) == 1 { ev := staticEvents[0] path := c.hugo().BaseFs.SourceFilesystems.MakeStaticPathRelative(ev.Name) path = c.firstPathSpec().RelURL(helpers.ToSlashTrimLeading(path), false) + livereload.RefreshPath(path) } else { livereload.ForceRefresh() @@ -1107,6 +1109,10 @@ func (c *commandeer) handleEvents(watcher *watcher.Batcher, if doLiveReload { if len(partitionedEvents.ContentEvents) == 0 && len(partitionedEvents.AssetEvents) > 0 { + if c.wasError { + livereload.ForceRefresh() + return + } changed := c.changeDetector.changed() if c.changeDetector != nil && len(changed) == 0 { // Nothing has changed. |