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

Browser does not refresh after changing Sass collected with Match #12456

Closed
jmooring opened this issue May 2, 2024 · 3 comments · Fixed by #12461
Closed

Browser does not refresh after changing Sass collected with Match #12456

jmooring opened this issue May 2, 2024 · 3 comments · Fixed by #12461

Comments

@jmooring
Copy link
Member

jmooring commented May 2, 2024

The issue title is imperfect... it is certainly not true in the general sense. There's something about ranging through a slice of Sass files that's triggering this.

Reference: https://discourse.gohugo.io/t/scss-changes-do-not-reload-live/49591

This works as expected in v0.122.0, but fails with v0.123.0 and later.

git clone --single-branch -b hugo-forum-topic-49591 https://github.com/jmooring/hugo-testing hugo-forum-topic-49591
cd hugo-forum-topic-49591
hugo server

Browse to http://localhost:1313/, then make changes to assets/dir/b.scss.

Results:

  • Expected: home page shows changes.
  • Actual: no change.

Note that changes to assets/a.scss are shown immediately.


assets/
├── dir/
│   └── b.scss
└── a.scss

layouts/partials/css.html

{{ $a := slice (resources.Get "a.scss") }}
{{ $b := resources.Match "dir/*.scss" }}

{{/* Add styles in a specific order. */}}
{{ $styles := slice $a $b }}

{{ $stylesheets := slice }}
  {{ range $styles }}
  {{ $stylesheets = $stylesheets | collections.Append . }}
{{ end }}

{{ range $stylesheets }}
  {{ with . | resources.ToCSS | fingerprint }}
    <link as="style"  href="{{ .RelPermalink }}" rel="preload stylesheet">
  {{ end }}
{{ end }}
@bep bep changed the title Browser does not refresh after changing Sass file Browser does not refresh after changing Sass file in some odd case May 2, 2024
@bep bep changed the title Browser does not refresh after changing Sass file in some odd case Browser does not refresh after changing Sass collected with Match May 2, 2024
@bep
Copy link
Member

bep commented May 2, 2024

That looks like an odd construct, but I will have a look at it and fix it.

Note that most of these issues can be worked around with a cache buster entry.

@bep bep self-assigned this May 3, 2024
@bep bep added this to the v0.125.6 milestone May 3, 2024
bep added a commit to bep/hugo that referenced this issue May 5, 2024
@bep bep closed this as completed in #12461 May 5, 2024
bep added a commit that referenced this issue May 5, 2024
This is how we should have fixed #1239.

Fixes #12456
@adrian5
Copy link

adrian5 commented May 10, 2024

I'm still experiencing this with Hugo v0.125.7+extended linux/amd64 on Firefox and Chromium. The page reloads on edits, but the inserted CSS bundle doesn't change.

@jmooring
Copy link
Member Author

@adrian5 This is issue resolved and closed. I suspect you have a different problem. Please create a topic in the forum where we can gather details and create a reproducible example.

@gohugoio gohugoio locked and limited conversation to collaborators May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants