From 8496fdfb1b5fc6ba28df6c6556ddb6b50343a21e Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Thu, 23 Feb 2023 15:55:45 +0000
Subject: [PATCH] refactor main js bundle load sequence
---
layouts/partials/scripts/bundle.html | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/layouts/partials/scripts/bundle.html b/layouts/partials/scripts/bundle.html
index 5e715b2..0bd2666 100644
--- a/layouts/partials/scripts/bundle.html
+++ b/layouts/partials/scripts/bundle.html
@@ -13,6 +13,9 @@
{{- $searchPath := "js/search.js" }}
{{- $search := resources.Get $searchPath | resources.ExecuteAsTemplate $searchPath . }}
+{{- $modePath := "js/mode.js" }}
+{{- $mode := resources.Get $modePath | resources.ExecuteAsTemplate $modePath . }}
+
{{- $mainScriptPath := "js/index.js" }}
{{- $main := resources.Get $mainScriptPath | resources.ExecuteAsTemplate $mainScriptPath . }}
@@ -22,14 +25,14 @@
{{ end }}
{{- $custom := resources.Get $customScriptPath | resources.ExecuteAsTemplate $customScriptPath . }}
-{{- $bundle := slice $variables $functions $code $main $fuse $search $custom | resources.Concat "js/bundle.js" | resources.Fingerprint "sha512" }}
-<script src="{{ $bundle.Permalink }}"></script>
+{{- $bundle := slice $variables $functions $code $mode $main $fuse $search $custom | resources.Concat "js/bundle.js" | resources.Fingerprint "sha512" }}
+<script src="{{ $bundle.Permalink }}" async></script>
{{- partialCached "hooks/scripts" . -}}
{{- $sp := .Site.Params }}
{{- with $sp.customJS }}
{{- range . -}}
- <script src="{{ . }}"></script>
+ <script src="{{ . }}" async></script>
{{- end }}
{{- end -}}
--
Gitblit v1.10.0