So I’m trying to use resources.PostProcess/PostCSS to purge unused styles from the stylesheet. However I also wanted to implement sub-resource integrity, which requires the generating a checksum (through resources.Fingerprint) of the final stylesheet. This does not work and generates and error, and thinking about this it makes sense - it can’t fingerprint something that won’t be finished until after the main build!
Am I missing something here? Is there a workaround I could use to have both PostProcess and SRI implemented on a site? Or is it not currently possible with how PostProcess works in Hugo?
Here is a simplified example of the problematic code:
Hmm, looking at my actual code PostProcess is definitely last in the chain. (Though is only executed in production mode.) Tried piping resources.Fingerprint to PostProcess as well but it still results in the same error.
For completeness here is the “real” block of code I was trying to use:
The above isn’t exacly the same as you had, but is what I would prefer. Two comments:
I don’t think “double” post processing works that well.
Also, there is an open issue about post processing with fast render mode (the default), which makes me prefer doing that for the production build only.