Styles not reloading on change

Suddenly having issues with styles not reloading on change. I’m using Hugo Pipes to build styles, and importing .scss files via a single SCSS file (app.scss). Here’s how I’m building the stylesheet in /layouts/styles.html:

{{ $s := resources.Get "sass/app.scss" | toCSS | postCSS (dict "config" "postcss.config.js") | minify }}
<link rel="stylesheet" href="{{ $s.Permalink }}" />

Command line isn’t give me any specific feedback on why this is failing. Interestingly enough, the parent app.scss file does trigger a reload on save.

I’ve tried a number of things to resolve, none with success:

  • Updated Hugo (running v0.74.3)
  • Reinstall NPM deps
  • Changed name of styles directory (to scss)

Any help would be greatly appreciated — I haven’t found a thread that documents a solution.

1 Like

Can you post a link the public repository for you site? That would be helpful.

Happy to. It’s a private repo but I’ll see if I can setup a reduce test case.


Does this happen during development (live reload) or on build? If locally, try to run Hugo with --disableFastRender – in my case it helped.

It’s happening during development and --disableFastRender hasn’t solved the issue unfortunately.

I’m running seperate pipes for dev and build:

{{ $cssOpts := (dict "targetPath" "css/app.css" "outputStyle" "compressed" "enableSourceMap" false "includePaths" (slice "./node_modules/foundation-sites/scss" "./node_modules/motion-ui/src" "./klaro" )) }}
{{ $cssDevOpts := (dict "targetPath" "css/app.css" "outputStyle" "expanded" "enableSourceMap" true "includePaths" (slice "./node_modules/foundation-sites/scss" "./node_modules/motion-ui/src" "./klaro" )) }}
{{ $styles := resources.Get "scss/app.scss" | toCSS $cssOpts | postCSS | fingerprint }}
{{ if .Site.IsServer }}
{{ $styles = resources.Get "scss/app.scss" | toCSS $cssDevOpts }}
{{ end }}

Maybe in your case removing postCSS and minify from the pipeline helps. Sorry, not quite a solution but my best bet …

Generally postCSS would be my first suspect for causing trouble.

Thanks totoff — I’ll give this a try.

So I removed the PostCSS and minify steps from the pipeline and the updates on save started working! Then I quit the process, tried it again and back to no longer working. I also noticed that now my system says it can no longer find hugo (I updated Hugo in an attempt to troubleshoot this issue), so I have some larger issues to resolve now.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.