0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00
Bootstrap/site/layouts/partials/scripts.html
XhmikosR 6637154beb
Revert "Use Hugo mounts for our docs vendor files." (#32210)
* Revert "Adapt to the recent main changes"

This reverts commit 50d8921670.

* Revert "Add Hugo Pipes logic for local and vendored scripts."

This reverts commit 3fcfd606f2.

* Revert "Use Hugo mounts for our docs vendor JS files."

This reverts commit 6b071116f3.
2020-11-19 21:09:34 +02:00

21 lines
913 B
HTML

{{ if eq hugo.Environment "production" -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.min.js" {{ printf "integrity=%q" .Site.Params.cdn.js_bundle_hash | safeHTMLAttr }} crossorigin="anonymous"></script>
{{ else -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>
{{- end }}
{{ if eq .Page.Layout "docs" -}}
<script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
{{- end }}
{{- $vendor := resources.Match "js/vendor/*.js" -}}
{{- $js := resources.Match "js/*.js" -}}
{{- $targetDocsJSPath := printf "/docs/%s/assets/js/docs.js" .Site.Params.docs_version -}}
{{- $docsJs := append $js $vendor | resources.Concat $targetDocsJSPath -}}
{{- if eq hugo.Environment "production" -}}
{{- $docsJs = $docsJs | resources.Minify -}}
{{- end }}
<script src="{{ $docsJs.Permalink | relURL }}"></script>