enable reading template variable from JS files
This commit is contained in:
parent
e7eb6932e2
commit
e90b28cd24
4 changed files with 9 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
public
|
public
|
||||||
|
resources
|
|
@ -1,4 +1,5 @@
|
||||||
const light = '🌝', dark = '🌚';
|
const light = '{{ index .Site.Params.switch 1 }}',
|
||||||
|
dark = '{{ index .Site.Params.switch 0 }}';
|
||||||
const LIGHT = 'light', DARK = 'dark';
|
const LIGHT = 'light', DARK = 'dark';
|
||||||
const themeSwitcher = document.getElementById('theme-switcher');
|
const themeSwitcher = document.getElementById('theme-switcher');
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ disqusShortname = "hugo-minima"
|
||||||
[author]
|
[author]
|
||||||
name = "XJJ"
|
name = "XJJ"
|
||||||
slogon = "A student and web developer from Earth 🌍"
|
slogon = "A student and web developer from Earth 🌍"
|
||||||
description = "This is Minima, a clean and minimal Hugo theme porting from Minima on Hexo. It not only inherits everything from Hexo Minima like dark/light mode but intgrated KaTeX and some taxonomies like categories, series and tags. I created this from scratch using pure CSS and Vanilla JS without using unnecessary development packs! 😁"
|
description = "This is Minima, a clean and minimal Hugo theme porting from Minima on Hexo. It not only inherits everything from Hexo Minima like dark/light mode but intgrated KaTeX and some taxonomies like categories, series and tags. I created this from scratch using SCSS and Vanilla JS without unnecessary development packs! 😁"
|
||||||
|
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
@ -27,6 +27,8 @@ subtitle = ""
|
||||||
comment = "disqus"
|
comment = "disqus"
|
||||||
# timeformat
|
# timeformat
|
||||||
timeformat = "Jan 2, 2006"
|
timeformat = "Jan 2, 2006"
|
||||||
|
# switch for turning on/off lights.
|
||||||
|
switch = ["🌚", "🌝"]
|
||||||
|
|
||||||
|
|
||||||
# OvO is a comment plugin written by the author of Minima.
|
# OvO is a comment plugin written by the author of Minima.
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
|
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
|
||||||
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
|
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
|
||||||
|
|
||||||
{{ $options := (dict "targetPath" (printf `minima.%d.js` $hash) "minify" true) }}
|
{{ $options = (dict "targetPath" (printf `minima.%d.js` $hash) "minify" true) }}
|
||||||
{{ $js := resources.Get "js/main.js" | js.Build $options }}
|
{{ $js := resources.Get "js/main.js" | js.Build $options | resources.ExecuteAsTemplate (printf `minima.%d.js` $hash) . }}
|
||||||
<script defer type="text/javascript" src="{{ $js.RelPermalink }}"></script>
|
<script defer type="text/javascript" src="{{ $js.RelPermalink }}"></script>
|
||||||
</head>
|
</head>
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in a new issue