portails/layouts/partials/footer/script-footer.html

18 lines
1.2 KiB
HTML
Raw Normal View History

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-04-15 15:48:16 +02:00
{{ if eq (hugo.Environment) "development" -}}
{{ $app := resources.Get "js/app.js" -}}
2020-11-04 08:26:58 +01:00
{{ $js := slice $lazysizes $flexsearch $app | resources.Concat "main.js" -}}
<script src="{{ $index.Permalink }}" defer></script>
2020-04-15 15:48:16 +02:00
<script src="{{ $js.Permalink }}" defer></script>
{{ 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-11-04 08:26:58 +01:00
{{ $js := slice $lazysizes $flexsearch $instantPage $app | resources.Concat "main.js" -}}
{{ $jsProd := $js | resources.Fingerprint "sha512" -}}
{{ $indexProd := $index | resources.Minify | resources.Fingerprint "sha512" -}}
<script src="{{ $indexProd.Permalink }}" integrity="{{ $indexProd.Data.Integrity }}" crossorigin="anonymous" defer></script>
<script src="{{ $jsProd.Permalink }}" integrity="{{ $jsProd.Data.Integrity }}" crossorigin="anonymous" defer></script>
2020-04-15 15:48:16 +02:00
{{ end -}}