2020-11-04 08:26:58 +01:00
|
|
|
{{ $indexTemplate := resources.Get "js/index.js" -}}
|
|
|
|
{{ $index := $indexTemplate | resources.ExecuteAsTemplate "index.js" . -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
|
2021-03-04 17:53:25 +01:00
|
|
|
{{ $bs := resources.Get "js/bootstrap.js" -}}
|
|
|
|
{{ $bs := $bs | js.Build -}}
|
|
|
|
|
2021-03-15 18:55:49 +01:00
|
|
|
{{ $highlight := resources.Get "js/highlight.js" -}}
|
|
|
|
{{ $highlight := $highlight | js.Build -}}
|
|
|
|
|
2021-03-16 15:14:45 +01:00
|
|
|
{{ $katex := resources.Get "js/vendor/katex/dist/katex.js" -}}
|
|
|
|
{{ $katexAutoRender := resources.Get "js/vendor/katex/dist/contrib/auto-render.js" -}}
|
|
|
|
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $app := resources.Get "js/app.js" -}}
|
|
|
|
|
|
|
|
{{ $slice := slice $app -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.lazySizes -}}
|
2021-03-01 16:52:18 +01:00
|
|
|
{{ $lazySizes := resources.Get "js/lazysizes.js" -}}
|
|
|
|
{{ $lazySizes := $lazySizes | js.Build -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $slice = $slice | append $lazySizes -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.clipBoard -}}
|
2021-03-01 16:52:18 +01:00
|
|
|
{{ $clipBoard := resources.Get "js/clipboard.js" -}}
|
|
|
|
{{ $clipBoard := $clipBoard | js.Build -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $slice = $slice | append $clipBoard -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.instantPage -}}
|
2021-03-01 16:52:18 +01:00
|
|
|
{{ $instantPage := resources.Get "js/instant.page.js" -}}
|
|
|
|
{{ $instantPage := $instantPage | js.Build -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $slice = $slice | append $instantPage -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.flexSearch -}}
|
2021-03-01 16:52:18 +01:00
|
|
|
{{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.min.js" -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $slice = $slice | append $flexSearch -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.darkMode -}}
|
2021-03-01 16:52:18 +01:00
|
|
|
{{ $darkMode := resources.Get "js/darkmode.js" -}}
|
|
|
|
{{ $darkMode := $darkMode | js.Build -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $slice = $slice | append $darkMode -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
2021-03-16 15:14:45 +01:00
|
|
|
{{ if .Site.Params.options.kaTex -}}
|
|
|
|
{{ $katexConfig := resources.Get "js/katex.js" -}}
|
|
|
|
{{ $katexConfig := $katexConfig | js.Build -}}
|
|
|
|
{{ $slice = $slice | append $katexConfig -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $js := $slice | resources.Concat "main.js" -}}
|
|
|
|
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ if eq (hugo.Environment) "development" -}}
|
2021-03-04 17:53:25 +01:00
|
|
|
{{ if .Site.Params.options.bootStrapJs -}}
|
|
|
|
<script src="{{ $bs.Permalink }}" defer></script>
|
|
|
|
{{ end -}}
|
2020-04-15 15:48:16 +02:00
|
|
|
<script src="{{ $js.Permalink }}" defer></script>
|
2021-03-15 18:55:49 +01:00
|
|
|
{{ if .Site.Params.options.highLight -}}
|
|
|
|
<script src="{{ $highlight.Permalink }}" defer></script>
|
|
|
|
{{ end -}}
|
2021-03-16 15:14:45 +01:00
|
|
|
{{ if .Site.Params.options.kaTex -}}
|
|
|
|
<script src="{{ $katex.Permalink }}" defer></script>
|
|
|
|
<script src="{{ $katexAutoRender.Permalink }}" onload="renderMathInElement(document.body);" defer></script>
|
|
|
|
{{ end -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ if .Site.Params.options.flexSearch -}}
|
|
|
|
<script src="{{ $index.Permalink }}" defer></script>
|
|
|
|
{{ end -}}
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ else -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $js := $js | minify | fingerprint "sha512" -}}
|
|
|
|
{{ $index := $index | minify | fingerprint "sha512" -}}
|
2021-03-04 17:53:25 +01:00
|
|
|
{{ $bs := $bs | minify | fingerprint "sha512" -}}
|
2021-03-15 18:55:49 +01:00
|
|
|
{{ $highlight := $highlight | minify | fingerprint "sha512" -}}
|
2021-03-16 15:14:45 +01:00
|
|
|
{{ $katex := $katex | minify | fingerprint "sha512" -}}
|
|
|
|
{{ $katexAutoRender := $katexAutoRender | minify | fingerprint "sha512" -}}
|
2021-03-04 17:53:25 +01:00
|
|
|
{{ if .Site.Params.options.bootStrapJs -}}
|
2021-03-15 18:55:49 +01:00
|
|
|
<script src="{{ $bs.Permalink }}" integrity="{{ $bs.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
2021-03-04 17:53:25 +01:00
|
|
|
{{ end -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
<script src="{{ $js.Permalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
2021-03-15 18:55:49 +01:00
|
|
|
{{ if .Site.Params.options.highLight -}}
|
2021-03-16 15:14:45 +01:00
|
|
|
<script src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
|
|
|
{{ end -}}
|
|
|
|
{{ if .Site.Params.options.kaTex -}}
|
|
|
|
<script src="{{ $katex.Permalink }}" integrity="{{ $katex.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
|
|
|
<script src="{{ $katexAutoRender.Permalink }}" integrity="{{ $katexAutoRender.Data.Integrity }}" crossorigin="anonymous" onload="renderMathInElement(document.body);" defer></script>
|
2021-03-15 18:55:49 +01:00
|
|
|
{{ end -}}
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ if .Site.Params.options.flexSearch -}}
|
|
|
|
<script src="{{ $index.Permalink }}" integrity="{{ $index.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
|
|
|
{{ end -}}
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ end -}}
|