2020-11-04 08:26:58 +01:00
|
|
|
{{ $indexTemplate := resources.Get "js/index.js" -}}
|
|
|
|
{{ $index := $indexTemplate | resources.ExecuteAsTemplate "index.js" . -}}
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ $lazysizes := resources.Get "js/vendor/lazysizes/lazysizes.min.js" -}}
|
2020-11-04 08:26:58 +01:00
|
|
|
{{ $flexsearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.min.js" -}}
|
2020-12-03 16:07:04 +01:00
|
|
|
{{ $clipboard := resources.Get "js/vendor/clipboard/dist/clipboard.min.js" -}}
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ if eq (hugo.Environment) "development" -}}
|
|
|
|
{{ $app := resources.Get "js/app.js" -}}
|
2020-12-03 16:07:04 +01:00
|
|
|
{{ $js := slice $lazysizes $clipboard $flexsearch $app | resources.Concat "main.js" -}}
|
2020-04-15 15:48:16 +02:00
|
|
|
<script src="{{ $js.Permalink }}" defer></script>
|
2020-12-06 12:03:41 +01:00
|
|
|
<script src="{{ $index.Permalink }}" defer></script>
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ else -}}
|
2020-11-04 08:26:58 +01:00
|
|
|
{{ $instantPage := resources.Get "js/vendor/instant.page/instantpage.js" | minify -}}
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ $app := resources.Get "js/app.js" | minify -}}
|
2020-12-03 16:07:04 +01:00
|
|
|
{{ $js := slice $lazysizes $clipboard $flexsearch $instantPage $app | resources.Concat "main.js" -}}
|
2020-11-04 08:26:58 +01:00
|
|
|
{{ $jsProd := $js | resources.Fingerprint "sha512" -}}
|
|
|
|
{{ $indexProd := $index | resources.Minify | resources.Fingerprint "sha512" -}}
|
|
|
|
<script src="{{ $jsProd.Permalink }}" integrity="{{ $jsProd.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
2020-12-06 12:03:41 +01:00
|
|
|
<script src="{{ $indexProd.Permalink }}" integrity="{{ $indexProd.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
2020-04-15 15:48:16 +02:00
|
|
|
{{ end -}}
|