inline essential js only
Signed-off-by: weru <fromweru@gmail.com>
| | |
| | | {{- 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" . -}} |
| | |
| | | {{- $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 }} |