Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/google/docsy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrice Chalin <chalin@users.noreply.github.com>2022-08-19 03:18:12 +0300
committerGitHub <noreply@github.com>2022-08-19 03:18:12 +0300
commit10fae88de482d836f0c81437afad5674418a888d (patch)
tree6b2defd62b04dfda9ee5e93873c886f4a359c0cd
parent734358534538294c8263d6d1ee035f14bef6ea0f (diff)
Scripts: get bootstrap.js and popper.js at build time (#1187)
-rw-r--r--layouts/partials/scripts.html12
1 files changed, 4 insertions, 8 deletions
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 4c5c052..f5d081b 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -1,9 +1,3 @@
-<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
- integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
- crossorigin="anonymous"></script>
-<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js"
- integrity="sha512-UR25UO94eTnCVwjbXozyeVd6ZqpaAE9naiEUBK/A+QDbfSTQFhPGj5lOR6d8tsgbBk84Ggb5A3EkjsOgPRPcKA=="
- crossorigin="anonymous"></script>
{{ if .Site.Params.mermaid.enable -}}
<script src="https://cdn.jsdelivr.net/npm/mermaid@9.1.3/dist/mermaid.min.js" integrity="sha512-E/owfVh8/U1xwhvIT4HSI064DRc1Eo/xf7AYax84rt9gVqA8tc/JNH/lvTl1tuw9PUHQIMGUtObkjYkgRjFqAA==" crossorigin="anonymous"></script>
{{ end -}}
@@ -55,6 +49,8 @@ window.markmap = {
{{ printf "onload='renderMathInElement(%s, %s);'" (( .Site.Params.katex.html_dom_element | default "document.body" ) | safeJS ) ( printf "%s" ( $.Site.Params.katex.options | jsonify )) | safeHTMLAttr }}></script>
{{ end -}}
+{{ $jsPopper := resources.GetRemote "https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" -}}
+{{ $jsBs := resources.Get "vendor/bootstrap/dist/js/bootstrap.js" -}}
{{ $jsBase := resources.Get "js/base.js" -}}
{{ $jsAnchor := resources.Get "js/anchor.js" -}}
{{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" .Site.Home -}}
@@ -63,9 +59,9 @@ window.markmap = {
{{ $jsPlantuml := resources.Get "js/plantuml.js" | resources.ExecuteAsTemplate "js/plantuml.js" . -}}
{{ $jsDrawio := resources.Get "js/drawio.js" | resources.ExecuteAsTemplate "js/plantuml.js" . -}}
{{ if .Site.Params.offlineSearch -}}
-{{ $jsSearch = resources.Get "js/offline-search.js" -}}
+ {{ $jsSearch = resources.Get "js/offline-search.js" -}}
{{ end -}}
-{{ $js := (slice $jsBase $jsAnchor $jsSearch $jsMermaid $jsPlantuml $jsMarkmap $jsDrawio) | resources.Concat "js/main.js" -}}
+{{ $js := (slice $jsPopper $jsBs $jsBase $jsAnchor $jsSearch $jsMermaid $jsPlantuml $jsMarkmap $jsDrawio) | resources.Concat "js/main.js" -}}
{{ if hugo.IsProduction -}}
{{ $js := $js | minify | fingerprint -}}
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous"></script>