51 lines
1.8 KiB
HTML
51 lines
1.8 KiB
HTML
{{ $indexTemplate := resources.Get "js/index.js" -}}
|
|
{{ $index := $indexTemplate | resources.ExecuteAsTemplate "index.js" . -}}
|
|
|
|
{{ $app := resources.Get "js/app.js" -}}
|
|
|
|
{{ $slice := slice $app -}}
|
|
|
|
{{ if .Site.Params.options.lazySizes -}}
|
|
{{ $lazySizes := resources.Get "js/lazysizes.js" -}}
|
|
{{ $lazySizes := $lazySizes | js.Build -}}
|
|
{{ $slice = $slice | append $lazySizes -}}
|
|
{{ end -}}
|
|
|
|
{{ if .Site.Params.options.clipBoard -}}
|
|
{{ $clipBoard := resources.Get "js/clipboard.js" -}}
|
|
{{ $clipBoard := $clipBoard | js.Build -}}
|
|
{{ $slice = $slice | append $clipBoard -}}
|
|
{{ end -}}
|
|
|
|
{{ if .Site.Params.options.instantPage -}}
|
|
{{ $instantPage := resources.Get "js/instant.page.js" -}}
|
|
{{ $instantPage := $instantPage | js.Build -}}
|
|
{{ $slice = $slice | append $instantPage -}}
|
|
{{ end -}}
|
|
|
|
{{ if .Site.Params.options.flexSearch -}}
|
|
{{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.min.js" -}}
|
|
{{ $slice = $slice | append $flexSearch -}}
|
|
{{ end -}}
|
|
|
|
{{ if .Site.Params.options.darkMode -}}
|
|
{{ $darkMode := resources.Get "js/darkmode.js" -}}
|
|
{{ $darkMode := $darkMode | js.Build -}}
|
|
{{ $slice = $slice | append $darkMode -}}
|
|
{{ end -}}
|
|
|
|
{{ $js := $slice | resources.Concat "main.js" -}}
|
|
|
|
{{ if eq (hugo.Environment) "development" -}}
|
|
<script src="{{ $js.Permalink }}" defer></script>
|
|
{{ if .Site.Params.options.flexSearch -}}
|
|
<script src="{{ $index.Permalink }}" defer></script>
|
|
{{ end -}}
|
|
{{ else -}}
|
|
{{ $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 -}}
|
|
{{ end -}} |