This repository has been archived on 2020-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
Syllabus/themes/piratecare/layouts/partials/css.html

28 lines
1.2 KiB
HTML

{{ if eq hugo.Environment "gitea" }}
<link rel="stylesheet" href="/css/styles.css">
{{ else if .Site.IsServer }}
{{ $style := resources.Get "css/styles.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{ 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/styles.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">
{{ end }}
{{ end }}