variant: make auto variant work in all combinations of root/subfolder and hugo/hugo server #516

This commit is contained in:
Sören Weber 2023-05-18 15:56:16 +02:00
parent c975dfd2de
commit c3a67fad85
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

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