From 7d4f8d5650b55955b7cda7611ea7d23251569dd8 Mon Sep 17 00:00:00 2001 From: bkrl <97085527+bkrl@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:13:03 -0800 Subject: [PATCH] feat: run PostCSS on vendor CSS (#2644) Currently, PostCSS can optionally be run on the main CSS bundle. This commit allows PostCSS to also be run on the vendor CSS. This can greatly reduce the size of the vendor CSS bundle when combined with PurgeCSS since most of the Font Awesome CSS is unused. --- wowchemy/layouts/partials/site_head.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wowchemy/layouts/partials/site_head.html b/wowchemy/layouts/partials/site_head.html index 3a8b1283..9d365ab8 100644 --- a/wowchemy/layouts/partials/site_head.html +++ b/wowchemy/layouts/partials/site_head.html @@ -101,9 +101,16 @@ {{- $stylesheets = $stylesheets | append (resources.Get (printf "css/libs/%s.css" . ) ) -}} {{- end -}} {{ $stylesheets = $stylesheets | resources.Concat "css/vendor-bundle.css" | minify }} + {{- if eq (getenv "WC_POST_CSS") "true" -}} + {{- $stylesheets = $stylesheets | postCSS -}} + {{- end -}} {{- if hugo.IsProduction -}} {{- $stylesheets = $stylesheets | fingerprint "md5" -}} {{- end -}} + {{- if eq (getenv "WC_POST_CSS") "true" -}} + {{/* PostProcess must be last action in the pipeline */}} + {{- $stylesheets = $stylesheets | resources.PostProcess -}} + {{- end -}} {{ $scr.Set "vendor_css_filename" "main.min.css" }}