commands: Fix flaw in the livereload logic

I guess most commonly an issue with TailwindCSS editing in templates:

* Build changes both CSS and index.html => reload OK.
* Build changes both CSS and index.html and some other files => only CSS reloaded.

The above would fix itself with one more edit, but that's annoying.
This commit is contained in:
Bjørn Erik Pedersen 2024-11-25 10:39:17 +01:00
parent 467444ef64
commit dea158c885
No known key found for this signature in database

View file

@ -966,7 +966,7 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
pathToRefresh := h.PathSpec.RelURL(paths.ToSlashTrimLeading(otherChanges[0]), false)
lrl.Logf("refreshing %q", pathToRefresh)
livereload.RefreshPath(pathToRefresh)
} else if len(cssChanges) == 0 {
} else if len(cssChanges) == 0 || len(otherChanges) > 1 {
lrl.Logf("force refresh")
livereload.ForceRefresh()
}