Error: Error building site: POSTCSS: failed to transform “css/style.css” (text/css): resource “css/css/style.css_674d3a8c056e8697f10ad004211806b8” not found in file cache
I have absolutely no idea why this is happening. All of a sudden today this started and won’t go away
The site builds okay on localhost. then I push to git. Pull on server and build and I get this error.
Who is caching this file? Hugo or postcss?
{{ $base := resources.Get "base.css" }}
{{ $custom := resources.Get "custom.css" }}
{{ $fa := resources.Get "font-awesome.min.css" }}
{{ if hugo.IsProduction }}
{{ $css := slice $base $custom $fa | resources.Concat "css/style.css" | resources.PostCSS | resources.PostProcess }}
<link lazyload="1" href="{{ $css.Permalink }}" rel="stylesheet" async/>
{{ else }}
<link lazyload="1" href="{{ $base.Permalink }}" rel="stylesheet" async/>
<link lazyload="1" href="{{ $custom.Permalink }}" rel="stylesheet" async/>
<link lazyload="1" href="{{ $fa.Permalink }}" rel="stylesheet" async/>
{{ end }}
Here’s the bit of code I have.
Now I can’t even rebuild on localhost.
Here’s my minimal build script
#!/bin/bash
rm -rf public/
git pull
hugo -b="https://www.psychedelicsdaily.com/" --minify
I don’t understand who or what is caching and why. css/style.css is the final output, why is it being cached. Who is creating this file? Hugo or postcss?
Thank you.
Update: I rebooted, as I couldn’t figure out what/why this file was ‘cached’ or something. Then I made sure nvm/npm were found, did npm i
in project directory just for the hell of it, and now it builds without error.
What was that all about?!
Hugo does cache resources.
You can use the CLI flag --ignoreCache
or you can specify a cacheDir
in the project config and manually delete its contents.