Procházet zdrojové kódy

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
George Cushen před 3 roky
rodič
revize
01a25ecaec
1 změnil soubory, kde provedl 4 přidání a 0 odebrání
  1. 4 0
      wowchemy/layouts/partials/site_head.html

+ 4 - 0
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 -}}
   <link rel="stylesheet" href="{{ $style.RelPermalink }}" />
 
   {{ partial "marketing/google_analytics" . }}