Merge pull request #185 from SandaruKasa/style-culling
Cull excessive JS/CSS for `{dark,light}-without-swticher` styles
This commit is contained in:
commit
598b5686a9
3 changed files with 25 additions and 6 deletions
|
@ -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") }}
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
{{ $style = site.Params.style | lower }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not (in (slice "light-without-switcher" "dark-without-switcher" "auto-without-switcher") $style) }}
|
||||
{{ if not (in (slice "light-without-switcher" "dark-without-switcher") $style) }}
|
||||
{{ if ne "auto-without-switcher" $style }}
|
||||
<button class="theme-switcher">
|
||||
{{ i18n "darkTheme" }}
|
||||
</button>
|
||||
|
@ -84,4 +85,5 @@ function showContent() {
|
|||
document.body.style.visibility = 'visible';
|
||||
document.body.style.opacity = 1;
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue