Skip to content

Commit

Permalink
commands: Fix flaw in the livereload logic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bep committed Nov 25, 2024
1 parent 467444e commit dea158c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion commands/hugobuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit dea158c

Please sign in to comment.