Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live reload issue when both HTML and CSS changes #12600

Closed
bep opened this issue Jun 15, 2024 · 0 comments · Fixed by #12601
Closed

Live reload issue when both HTML and CSS changes #12600

bep opened this issue Jun 15, 2024 · 0 comments · Fixed by #12601
Assignees
Labels
Milestone

Comments

@bep
Copy link
Member

bep commented Jun 15, 2024

While testing the new defer feature, I found a peculiar issue in (at least) Chrome and Safari.

This is the typical "TailwindCSS workflow." I have previously recommended a workflow that watches the hugo_stats.json for changes, and in that setup, this isn't an issue (you get 2 builds, first the HTML, then the CSS).

But if you build both in one Go, we do a full browser reload, and the HTML change is visible, but not the CSS change (no fingerprinting of the CSS file).

This situation can be detected, and I have tested that this works:

  1. First do a reload of the page.
  2. Wait some ...
  3. Do a refresh of (only) the changed CSS.
@bep bep added the Bug label Jun 15, 2024
@bep bep added this to the v0.128.0 milestone Jun 15, 2024
@bep bep self-assigned this Jun 15, 2024
@bep bep closed this as completed Jun 15, 2024
@bep bep reopened this Jun 15, 2024
bep added a commit to bep/hugo that referenced this issue Jun 15, 2024
This seems to be a browser bug (tested in both Chrome and Safari on MacOS), but it seems that doing a `window.location.reload()` (or `window.location.reload(true)`) doesn't refresh the CSS changes, even if HTTP caching is disabled.

This commit works around this by doing additional refreshes of the CSSes.

Closes gohugoio#12600
@bep bep closed this as completed in ad6d91c Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant