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

weru
23.55.2023 8496fdfb1b5fc6ba28df6c6556ddb6b50343a21e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{{- $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 . }}
 
{{- $customScriptPath := "js/custom.js" }}
{{ if (fileExists "../../assets/js/custom.js") }}
  {{ $customScriptPath := "../../assets/js/custom.js" }}
{{ 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>
 
{{- partialCached "hooks/scripts" . -}}
 
{{- $sp := .Site.Params }}
{{- with $sp.customJS }}
  {{- range . -}}
    <script src="{{ . }}" async></script>
  {{- end }}
{{- end -}}