🥅 Catch when no JS required in bundle

pull/100/head
James Panther 2022-01-19 11:52:49 +11:00
parent e67c9d0d28
commit 7992ce0035
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
1 changed files with 4 additions and 2 deletions

View File

@ -56,8 +56,10 @@
{{ $jsDark := resources.Get "js/dark.js" }} {{ $jsDark := resources.Get "js/dark.js" }}
{{ $assets.Add "js" (slice $jsDark) }} {{ $assets.Add "js" (slice $jsDark) }}
{{ end }} {{ end }}
{{ $bundleJS := $assets.Get "js" | resources.Concat "js/main.bundle.js" | resources.Minify | resources.Fingerprint "sha512" }} {{ if $assets.Get "js" }}
<script defer type="text/javascript" src="{{ $bundleJS.RelPermalink }}" integrity="{{ $bundleJS.Data.Integrity }}"></script> {{ $bundleJS := $assets.Get "js" | resources.Concat "js/main.bundle.js" | resources.Minify | resources.Fingerprint "sha512" }}
<script defer type="text/javascript" src="{{ $bundleJS.RelPermalink }}" integrity="{{ $bundleJS.Data.Integrity }}"></script>
{{ end }}
{{/* Icons */}} {{/* Icons */}}
{{ if templates.Exists "partials/favicons.html" }} {{ if templates.Exists "partials/favicons.html" }}
{{ partialCached "favicons.html" .Site }} {{ partialCached "favicons.html" .Site }}