diff options
author | Quentin Barbe <quentin@barbe.me> | 2020-10-26 01:20:32 +0300 |
---|---|---|
committer | Quentin Barbe <quentin@barbe.me> | 2020-10-26 01:20:32 +0300 |
commit | 8f5c578e1d3e1b40fb23b60c3b34b3f2fed0edfc (patch) | |
tree | 3e1446c052622fe9a85d1a2a87af119d4971f43a /layouts/partials/head.html | |
parent | 82d6d8519c5c03811bdc138539d5ab1110722894 (diff) |
Minify CSS file for production builds
Diffstat (limited to 'layouts/partials/head.html')
-rw-r--r-- | layouts/partials/head.html | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 48b6ebd..bc8bcf0 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -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 -}} |