From 01a25ecaecdd075fbd2333c69c4a794a2da6283f Mon Sep 17 00:00:00 2001 From: George Cushen Date: Tue, 1 Jun 2021 19:35:57 +0100 Subject: [PATCH] feat: delay PostCSS processing with resources.PostProcess resources.PostProcess delays processing of a resource until the rest of the build has finished. This allows the public folder or Hugo's hugo_stats.json file to be used as the content for PurgeCSS, so that only CSS that is used on the final website will be included. Close #2318 --- wowchemy/layouts/partials/site_head.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wowchemy/layouts/partials/site_head.html b/wowchemy/layouts/partials/site_head.html index 24428505..2f48b227 100644 --- a/wowchemy/layouts/partials/site_head.html +++ b/wowchemy/layouts/partials/site_head.html @@ -198,6 +198,10 @@ {{- if hugo.IsProduction -}} {{- $style = $style | fingerprint "md5" -}} {{- end -}} + {{- if eq (getenv "WC_POST_CSS") "true" -}} + {{/* PostProcess must be last action in the pipeline */}} + {{- $style = $style | resources.PostProcess -}} + {{- end -}} {{ partial "marketing/google_analytics" . }}