diff options
author | Arthur Bailão <arthurbailao@gmail.com> | 2020-11-14 02:35:37 +0300 |
---|---|---|
committer | Arthur Bailão <arthurbailao@gmail.com> | 2020-11-14 02:35:37 +0300 |
commit | 2063877a7cf9b676fb409abe09f168c005c9b8cc (patch) | |
tree | a25fb9b33ee529d437f2ffe1ed04a4084e215154 | |
parent | c86968e3c998e38950404951bf7a7d311995c356 (diff) |
minifying and fingerprinting custom css files
-rw-r--r-- | layouts/partials/head/css.html | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html index cf5a301..62302c7 100644 --- a/layouts/partials/head/css.html +++ b/layouts/partials/head/css.html @@ -12,10 +12,18 @@ {{ end }} <!-- Custom css --> -{{ range .Site.Params.customCSS -}} -{{ $style := resources.Get . }} -<link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}" crossorigin="anonymous" media="screen"> -{{- end }} +{{ if .Site.IsServer }} + {{ range .Site.Params.customCSS -}} + {{ $style := resources.Get . }} + <link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}" crossorigin="anonymous" media="screen"> + {{- end }} +{{ else }} + {{ range .Site.Params.customCSS -}} + {{ $style := resources.Get . }} + {{ $bundle := $style | minify | fingerprint }} + <link rel="stylesheet" href="{{ $bundle.RelPermalink }}" integrity="{{ $bundle.Data.Integrity }}" crossorigin="anonymous" media="screen"> + {{- end }} +{{ end }} <!-- PhotoSwipe --> {{ if eq .Type "gallery" }} @@ -23,4 +31,4 @@ <link rel="stylesheet" href="{{ $photoswipe | absURL }}"> {{ $defaultSkin := "css/default-skin.css" }} <link rel="stylesheet" href="{{ $defaultSkin | absURL }}"> -{{ end }}
\ No newline at end of file +{{ end }} |