Hugo SASS pipelines do not recompile on updates in imported stylesheets

My SASS pipeline stopped working around the time GoHugo reworked it’s cache system earlier this year. Now all it does is acknowledging that a change was done in file x and reload, but it does not run the SASS pipeline again. I have to stop my Hugo server and start it again to have my changes processed.

While this is an issue, I am about 50% tired of finding out what is going on and just living with it (it doesn’t take too much time to restart) and 50% thinking to move my stylesheet generation outside of Hugo.

So this is just a simple attempt to prove that I am not dreaming my issues :wink:

Let’s assume I have this folder structure in assets:

image

My style.scss loads the _search.scss via @import:

...
@import "04-components/search";
...

Now let’s assume I have a running server and change something in _search.scs:

                   |  EN   
-------------------+-------
  Pages            |  836  
  Paginator pages  |   92  
  Non-page files   |  193  
  Static files     |   67  
  Processed images | 1181  
  Aliases          |  231  
  Cleaned          |    0  

Built in 3349 ms
Environment: "development"
Serving pages from disk
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1) 
Press Ctrl+C to stop

Change detected, rebuilding site (#1).
2024-08-18 21:58:09.179 +0700
Asset changed /scss/04-components/_search.scss
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Total in 195 ms

There is no actual processing going on, just a quick reload of the server.

I know that @import is something that will be removed from SASS in the future. It is not yet, so it should be acknowledged and processed properly. Also the fact that it is processing properly when I start the server signals that I don’t have some incompatible SCSS code in my setup.

My repo is public, so feel free to test around.

These days I am 90% sure that issues like this are due to my chaotic and “organically grown” repo structure with plenty of modules and replacement rules, but simply running hugo server fails to re-process my sass files too. So… yeah… maybe it’s not me, it’s you?

I don’t know why it doesn’t work in your setup, but you can get the “old behaviour” back by doing something ala:

[build]
  [[build.cachebusters]]
    source = 'scss'
    target = 'css'

Or something like that …

1 Like

That did the trick. Thank you!

1 Like

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