no more fingerprints after css which simplifies setup for all hugo envs...

This commit is contained in:
Marcell Mars 2020-09-10 12:15:24 +02:00
parent fedc45de60
commit 45bcf3f642
1 changed files with 5 additions and 26 deletions

View File

@ -1,30 +1,9 @@
{{ if (or (eq hugo.Environment "gitea") (eq hugo.Environment "preview") ) }}
<link rel="stylesheet" href="/css/site.min.css">
<link rel="stylesheet" href="/css/player.min.css">
{{ else if .Site.IsServer }}
<link rel="stylesheet" href="/css/site.min.css" />
<link rel="stylesheet" href="/css/player.min.css" />
{{ else if (or (eq hugo.Environment "offline") (.Site.IsServer)) }}
{{ $style := resources.Get "css/site.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
<link rel="stylesheet" href="{{ $style.Permalink }}" />
{{ $style := resources.Get "css/player.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{ else }}
{{ $flist := newScratch }}
{{ $flist.Set "initial" "nop" }}
{{ range (readDir "public/css") }}
{{ $finfo := os.Stat (printf "%s%s" "public/css/" .Name) }}
{{ $flist.SetInMap "css_files" (printf "%s" $finfo.ModTime) .Name }}
{{ $flist.Set "initial" "yay" }}
{{ end }}
{{ $css := "nop" }}
{{ if eq ($flist.Get "initial") "yay" }}
{{ $css = (index (last 1 ( $flist.GetSortedMapValues "css_files" )) 0) }}
{{ end }}
{{ if in $css "css" }}
<link rel="stylesheet" href="{{ "/css/" }}{{ $css }}">
{{ else }}
{{ $style := resources.Get "css/site.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{ end }}
<link rel="stylesheet" href="{{ $style.Permalink }}" />
{{ end }}