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

index.{scss,sass} files not handled in imports #13123

Closed
martinjagodic opened this issue Dec 10, 2024 · 3 comments · Fixed by #13124
Closed

index.{scss,sass} files not handled in imports #13123

martinjagodic opened this issue Dec 10, 2024 · 3 comments · Fixed by #13124
Assignees
Milestone

Comments

@martinjagodic
Copy link

Hot reload does not work properly when changing files in assets sub-subfolders (eg, assets/styles/components/_container.scss). The server detects a change, but new styles are not applied.

If you change a file that triggers the rebuild correctly, assets from subfolders also trigger it correctly from that point on.

Minimal reproduction repository: https://github.com/martinjagodic/hugo-sass-debug

What version of Hugo are you using (hugo version)?

$ hugo version
v0.139.3+extended+withdeploy darwin/arm64 BuildDate=2024-11-29T15:36:56Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yes. The bug started in v0.123.0 but is still present in v0.139.3. Tested only with hugo extended.

@bep
Copy link
Member

bep commented Dec 10, 2024

A workaround may be to set up some cache busting config, see https://gohugo.io/getting-started/configuration-build/#configure-cache-busters -- e.g.:

[build]
  [[build.cachebusters]]
    source = 'assets/.*\.(scss|sass)'
    target = 'css'

@bep bep changed the title Hot reload not working after changes in assets sub-subfolders index.{scss,sass} files not handled in imports Dec 10, 2024
@bep bep self-assigned this Dec 10, 2024
@bep
Copy link
Member

bep commented Dec 10, 2024

I had a quick look at the repo, and the reason that particular repo does not work is that Hugo's custom import resolver does not currently resolve index.scss files. If you rename that file to _index.scss things start working.

@martinjagodic
Copy link
Author

@bep thank you!! I don't even want to think about how many hours we wasted debugging this 😅 I can confirm that both your solutions work. I opted for build.cachebusters because adding _ to the index file defies all purpose of the underscore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants