1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-30 16:50:00 +02:00

Add Hugo Pipes logic for local and vendored scripts.

This commit is contained in:
Regis Philibert
2020-07-03 18:33:57 +03:00
committed by XhmikosR
parent 6b071116f3
commit 3fcfd606f2
3 changed files with 83 additions and 17 deletions

View File

@@ -4,17 +4,7 @@
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>
{{- end }}
{{ if eq .Page.Layout "docs" -}}
<script src="/docs/{{ .Site.Params.docs_version }}/assets/js/vendor/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>
{{- $variant := cond (eq .Page.Layout "docs") "docs" "default" -}}
{{- range partialCached "func/get-js-assets" . $variant -}}
<script src="{{ .RelPermalink }}"></script>
{{- end -}}