Cull excessive JS/CSS for {dark,light}-without-swticher styles

This commit is contained in:
SandaruKasa 2023-07-04 19:31:33 +03:00
parent f6769864be
commit f4e0412244
No known key found for this signature in database
GPG key ID: F33E2EE578F57268
3 changed files with 25 additions and 6 deletions

View file

@ -21,6 +21,12 @@
{{ partial "favicons.html" . }}
{{ $style := "light-without-switcher" }}
{{ if and (isset site.Params "style") (ne site.Params.style "") }}
{{ $style = site.Params.style | lower }}
{{ end }}
{{ if not (in (slice "light-without-switcher" "dark-without-switcher") $style) }}
<style>
body {
visibility: hidden;
@ -36,6 +42,7 @@
}
</style>
</noscript>
{{end}}
{{ partial "resource.html" (dict "context" . "type" "css" "filename" "css/main.css") }}