From e2784768ae8bb0934adb7e701074235a3519c597 Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Fri, 24 Feb 2023 15:58:15 +0000
Subject: [PATCH] add algolia

---
 layouts/partials/scripts/bundle.html |   29 +++++++----------------------
 1 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/layouts/partials/scripts/bundle.html b/layouts/partials/scripts/bundle.html
index 0bd2666..b282e40 100644
--- a/layouts/partials/scripts/bundle.html
+++ b/layouts/partials/scripts/bundle.html
@@ -1,23 +1,8 @@
-{{- $variablesPath := "js/variables.js" }}
-{{- $variables := resources.Get $variablesPath | resources.ExecuteAsTemplate $variablesPath . }}
-
-{{- $funcPath := "js/functions.js" }}
-{{- $functions := resources.Get $funcPath | resources.ExecuteAsTemplate $funcPath . }}
-
-{{- $codePath := "js/code.js" }}
-{{- $code := resources.Get $codePath | resources.ExecuteAsTemplate $codePath . }}
-
-{{- $fusePath := "js/fuse.js" }}
-{{- $fuse := resources.Get $fusePath | resources.ExecuteAsTemplate $fusePath . }}
-
-{{- $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 . }}
+{{- $variables := partial "functions/getScript" (dict "slug" "variables") }}
+{{- $functions := partial "functions/getScript" (dict "slug" "functions") }}
+{{- $code := partial "functions/getScript" (dict "slug" "code") }}
+{{- $mode := partial "functions/getScript" (dict "slug" "mode") }}
+{{- $main := partial "functions/getScript" (dict "slug" "index") }}
 
 {{- $customScriptPath := "js/custom.js" }}
 {{ if (fileExists "../../assets/js/custom.js") }}
@@ -25,9 +10,9 @@
 {{ end }}
 {{- $custom := resources.Get $customScriptPath | resources.ExecuteAsTemplate $customScriptPath . }}
 
-{{- $bundle := slice $variables $functions $code $mode $main $fuse $search $custom | resources.Concat "js/bundle.js" | resources.Fingerprint "sha512" }}
-<script src="{{ $bundle.Permalink }}" async></script>
+{{- partial "scripts/getJsBundle" (dict "scripts" (slice $variables $functions $code $mode $main $custom) "slug" "bundle") }}
 
+{{- partialCached "scripts/search" . -}}
 {{- partialCached "hooks/scripts" . -}}
 
 {{- $sp := .Site.Params }}

--
Gitblit v1.10.0