Minify CSS file for production builds

This commit is contained in:
Quentin Barbe 2020-10-25 23:20:32 +01:00
parent 82d6d8519c
commit 8f5c578e1d
No known key found for this signature in database
GPG Key ID: C479C6EF498510C2

View File

@ -15,7 +15,11 @@
<link rel="apple-touch-icon-precomposed" href="{{ "favicon.png" | absURL }}">
{{ $cssTemplate := resources.Get "css/main.css" }}
{{ $style := $cssTemplate | resources.ExecuteAsTemplate "css/style.css" . | resources.ToCSS | resources.Fingerprint "sha256" }}
{{ $style := $cssTemplate | resources.ExecuteAsTemplate "css/style.css" . | resources.ToCSS }}
{{ if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ $style = $style | resources.Minify }}
{{ end }}
{{ $style = $style | resources.Fingerprint "sha256" }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{ range .Site.Params.customCSS -}}