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-01 16:40:14 +01:00
|
|
|
{{ $lazySizes := resources.Get "js/lazySizes.js" -}}
|
|
|
|
{{ $lazySizes := $lazySizes | js.Build -}}
|
|
|
|
|
|
|
|
{{ $clipBoard := resources.Get "js/clipBoard.js" -}}
|
|
|
|
{{ $clipBoard := $clipBoard | js.Build -}}
|
|
|
|
|
|
|
|
{{ $instantPage := resources.Get "js/instant.page.js" -}}
|
|
|
|
{{ $instantPage := $instantPage | js.Build -}}
|
|
|
|
|
|
|
|
{{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.min.js" -}}
|
|
|
|
|
|
|
|
{{ $darkMode := resources.Get "js/darkmode.js" -}}
|
|
|
|
{{ $darkMode := $darkMode | js.Build -}}
|
|
|
|
|
2021-03-01 16:34:43 +01:00
|
|
|
{{ $app := resources.Get "js/app.js" -}}
|
|
|
|
|
|
|
|
{{ $slice := slice $app -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.lazySizes -}}
|
|
|
|
{{ $slice = $slice | append $lazySizes -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.clipBoard -}}
|
|
|
|
{{ $slice = $slice | append $clipBoard -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.instantPage -}}
|
|
|
|
{{ $slice = $slice | append $instantPage -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.flexSearch -}}
|
|
|
|
{{ $slice = $slice | append $flexSearch -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ if .Site.Params.options.darkMode -}}
|
|
|
|
{{ $slice = $slice | append $darkMode -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{ $js := $slice | resources.Concat "main.js" -}}
|
|
|
|
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ if eq (hugo.Environment) "development" -}}
|
|
|
|
<script src="{{ $js.Permalink }}" defer></script>
|
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" -}}
|
|
|
|
<script src="{{ $js.Permalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
|
|
|
{{ 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 -}}
|