You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
1.1 KiB

  1. {{ if (or (eq hugo.Environment "gitea") (eq hugo.Environment "preview") ) }}
  2. <link rel="stylesheet" href="/css/site.css">
  3. {{ else if .Site.IsServer }}
  4. {{ $style := resources.Get "css/site.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify }}
  5. <link rel="stylesheet" href="{{ $style.Permalink }}">
  6. {{ else }}
  7. {{ $flist := newScratch }}
  8. {{ $flist.Set "initial" "nop" }}
  9. {{ range (readDir "public/css") }}
  10. {{ $finfo := os.Stat (printf "%s%s" "public/css/" .Name) }}
  11. {{ $flist.SetInMap "css_files" (printf "%s" $finfo.ModTime) .Name }}
  12. {{ $flist.Set "initial" "yay" }}
  13. {{ end }}
  14. {{ $css := "nop" }}
  15. {{ if eq ($flist.Get "initial") "yay" }}
  16. {{ $css = (index (last 1 ( $flist.GetSortedMapValues "css_files" )) 0) }}
  17. {{ end }}
  18. {{ if in $css "css" }}
  19. <link rel="stylesheet" href="{{ "/css/" }}{{ $css }}">
  20. {{ else }}
  21. {{ $style := resources.Get "css/site.css" | postCSS (dict "config" "./assets/css/postcss.config.js") | minify }}
  22. <link rel="stylesheet" href="{{ $style.Permalink }}">
  23. {{ end }}
  24. {{ end }}