Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zzossig/hugo-theme-zdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzzossig <zzossig@gmail.com>2020-10-29 21:39:37 +0300
committerzzossig <zzossig@gmail.com>2020-10-29 21:39:37 +0300
commit71d26cb70da8470d19010224e2b8b465ca92b1fc (patch)
treeb10879f4a0157d2ac22d2f4d4b29f6e553d40ef4
parent933f73dfd82604bc8cf92bb83b25e07e2a59f092 (diff)
sass deprecation warning fix
#34
-rw-r--r--assets/sass/abstracts/_mixins.scss1
-rw-r--r--layouts/_default/baseof.html14
2 files changed, 12 insertions, 3 deletions
diff --git a/assets/sass/abstracts/_mixins.scss b/assets/sass/abstracts/_mixins.scss
index 4fe0749..090a0cd 100644
--- a/assets/sass/abstracts/_mixins.scss
+++ b/assets/sass/abstracts/_mixins.scss
@@ -1,3 +1,4 @@
+$theme-map: null;
@mixin themify($themes) {
@each $theme, $map in $themes {
.theme__#{$theme} & {
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 90acffd..b184e8a 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -12,12 +12,20 @@
{{ partial "head/services" . }}
</head>
-<body id="root" class="theme__{{ index .Site.Params.themeOptions 0 }}">
+{{ $themeOptions := .Site.Params.themeOptions }}
+<body id="root" class="theme__{{ index $themeOptions 0 }}">
<script>
+ var rootElem = document.getElementById('root');
+ var themeOptions = JSON.parse({{ $themeOptions | jsonify }});
var localTheme = localStorage.getItem('theme');
+
if (localTheme) {
- document.getElementById('root').className = `theme__${localTheme}`;
- }
+ if (themeOptions && themeOptions.length > 0) {
+ themeOptions.includes(localTheme) ?
+ rootElem.className = `theme__${localTheme}` :
+ rootElem.className = `theme__${themeOptions[0]}`;
+ }
+ }
</script>
<div id="container">