mirror of https://github.com/onweru/compose.git

weru
28.38.2023 3230e2bc2e53eb00e66e77bf6568b591757d220b
inline essential js only

Signed-off-by: weru <fromweru@gmail.com>
2 files modified
8 ■■■■ changed files
layouts/partials/scripts/bundle.html 2 ●●● patch | view | raw | blame | history
layouts/partials/scripts/getJsBundle.html 6 ●●●● patch | view | raw | blame | history
layouts/partials/scripts/bundle.html
@@ -11,7 +11,7 @@
{{- end }}
{{- $custom := resources.Get $customScriptPath | resources.ExecuteAsTemplate $customScriptPath . }}
{{- partial "scripts/getJsBundle" (dict "scripts" (slice $variables $functions $code $mode $main $custom) "slug" "bundle") }}
{{- partial "scripts/getJsBundle" (dict "scripts" (slice $variables $functions $code $mode $main $custom) "slug" "bundle" "inline" true) }}
{{- partialCached "scripts/search" . -}}
{{- partialCached "hooks/scripts" . -}}
layouts/partials/scripts/getJsBundle.html
@@ -1,4 +1,8 @@
{{- $bundle := .scripts | resources.Concat (printf "js/%s.js" .slug) | resources.Minify | resources.Fingerprint "sha512" }}
{{- if .inline }}
<script>
  {{ safeJS $bundle.Content }}
</script>
</script>
{{- else }}
<script src="{{ $bundle.Permalink }}" async></script>
{{ end }}