variant: make auto switch work for hugo server and hugo #445

This commit is contained in:
Sören Weber 2023-02-04 23:28:57 +01:00
parent 5babf80537
commit df0a4102e2
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -27,8 +27,16 @@
{{- end -}}
{{- $themevariantsauto = ($themevariantsauto | first 2) -}}
{{- with index $themevariantsauto 0 -}}
{{- if site.IsServer -}}
@import "{{(printf "css/theme-%s.css" .) | relURL}}" screen;
{{- else -}}
@import "{{(printf "theme-%s.css" .)}}" screen;
{{- end -}}
{{- end -}}
{{- with index $themevariantsauto 1 }}
{{- with index $themevariantsauto 1 -}}
{{- if site.IsServer }}
@import "{{(printf "css/theme-%s.css" .) | relURL}}" screen and (prefers-color-scheme: dark);
{{- else }}
@import "{{(printf "theme-%s.css" .)}}" screen and (prefers-color-scheme: dark);
{{- end -}}
{{- end -}}