Skip to content

CSS resources refresh problem when "static" is mounted on "assets" (with example repo)Β #7740

Closed

Description

@divinerites

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

$ hugo version 
Hugo Static Site Generator v0.75.1/extended darwin/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?

yes.

  • When we mount /static/css/ in assets/css and use them as resources the refresh is not correctly done.
  • You can see a minimal example here
  • Steps to reproduce :
  1. go to index.htm => h2 is red in static/css/static.css & h3 is blue in assets/css/assets.css
  2. change background in assets.css for yellow => works as expected. Refresh OK. background is yellow.
  3. change background in static.css for green => there is no refresh. Background stays red. The site is rebuilt, but not refreshed (see message below)
  4. Change anything is assets.css and save => the refresh is OK and the static background is now showing green.
  5. --disableFastRender has no effect.
[[module.mounts]]
    source = "static/css"
    target = "assets/css"
[[module.mounts]]
    source = "assets/css"
    target = "assets/css"
Change of Static files detected, rebuilding site.
2020-09-27 15:56:49.063 +0200
Syncing css/static.css to /

Activity

  1. changed the title [-]CSS resources refresh problem when "static" is mounted on "assets"[/-] [+]CSS resources refresh problem when "static" is mounted on "assets" (with example repo)[/+] on Sep 27, 2020
  2. github-actions commented on Feb 19, 2022

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
    If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
    If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
    This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

  3. jmooring commented on Feb 24, 2022

    @jmooring
    Member

    This came up again, but when assets is mounted to static:
    https://discourse.gohugo.io/t/is-this-worth-mentioning-in-the-docs/37345

    To reproduce:

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

    Then in a new terminal:

    echo "body {color: red}" >> assets/css/assets.css
    echo "body {background-color: cyan}" >> static/css/static.css

    The page is not refreshed.

  4. github-actions commented on Feb 26, 2023

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
    If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
    If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
    This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

  5. divinerites commented on Feb 26, 2023

    @divinerites
    Author

    Still present in v0.110.0

  6. added this to the v0.131.0 milestone on Jul 30, 2024
  7. modified the milestones: v0.131.0, v0.133.0 on Aug 9, 2024
  8. modified the milestones: v0.133.0, Unscheduled on Aug 29, 2024
  9. github-actions commented on Aug 30, 2025

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
    If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
    If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
    This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

  10. jmooring commented on Aug 30, 2025

    @jmooring
    Member

    I'm inclined to close this, because the problem is caused by fingerprinting the published file when running hugo server. The recommended construct is something like this:

    {{ with resources.Get "css/static.css" }}
    	{{ $opts := dict
    		"minify" (cond hugo.IsDevelopment false true)
    		"sourceMap" (cond hugo.IsDevelopment "linked" "none")
    	}}
    	{{ with . | css.Build $opts }}
    		{{ if hugo.IsDevelopment }}
    			<link rel="stylesheet" href="{{ .RelPermalink }}">
    		{{ else }}
    			{{ with . | fingerprint }}
    				<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
    			{{ end }}
    		{{ end }}
    	{{ end }}
    {{ end }}
    
    git clone --single-branch -b hugo-forum-topic-37345 https://github.com/jmooring/hugo-testing hugo-forum-topic-37345
    cd hugo-forum-topic-37345
    hugo server

    Then in a new terminal:

    echo "body {color: red}" >> assets/css/assets.css
    echo "body {background-color: cyan}" >> static/css/static.css

    Works great.

  11. xndvaz commented on Jun 14, 2026

    @xndvaz
    Contributor

    Thanks for the clarification. I agree that this looks like a development-time fingerprinting issue rather than a general static -> assets mount problem.

    Given the existing css.Build examples already show the hugo.IsDevelopment pattern, I’ll hold off on another docs PR unless you think a very small clarification in that page would be useful.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions