2024-03-08 11:41:17 +01:00
|
|
|
{{ if hugo.IsProduction -}}
|
2024-03-08 11:53:43 +01:00
|
|
|
<script defer src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.min.js" {{ printf "integrity=%q" .Site.Params.cdn.js_bundle_hash | safeHTMLAttr }}></script>
|
2019-01-08 17:33:28 +01:00
|
|
|
{{ else -}}
|
2024-03-08 11:53:43 +01:00
|
|
|
<script defer src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>
|
2019-01-08 17:33:28 +01:00
|
|
|
{{- end }}
|
|
|
|
|
2024-03-08 11:43:44 +01:00
|
|
|
{{- $esbuildOptions := dict "target" "es2019" -}}
|
|
|
|
{{- $targetDocsJSPath := path.Join "/docs" .Site.Params.docs_version -}}
|
2020-11-19 20:09:34 +01:00
|
|
|
|
2024-03-08 11:41:17 +01:00
|
|
|
{{- if hugo.IsProduction -}}
|
2024-03-08 11:43:44 +01:00
|
|
|
{{- $esbuildOptions = merge $esbuildOptions (dict "minify" "true") -}}
|
2020-11-19 20:09:34 +01:00
|
|
|
{{- end }}
|
|
|
|
|
2024-03-08 11:43:44 +01:00
|
|
|
{{- $applicationJs := resources.Get "js/application.js" | js.Build $esbuildOptions | resources.Copy (path.Join $targetDocsJSPath "/assets/js/application.js") }}
|
2024-03-08 11:53:43 +01:00
|
|
|
<script defer src="{{ $applicationJs.RelPermalink }}"></script>
|
2022-03-09 16:32:58 +01:00
|
|
|
|
2024-03-08 11:43:44 +01:00
|
|
|
{{- if (ne .Page.Layout "examples") -}}
|
2024-03-13 07:38:53 +01:00
|
|
|
{{- $esbuildParams := dict
|
|
|
|
"apiKey" .Site.Params.algolia.apiKey
|
|
|
|
"appId" .Site.Params.algolia.appId
|
|
|
|
"indexName" .Site.Params.algolia.indexName
|
|
|
|
-}}
|
|
|
|
{{- $esbuildOptions = merge $esbuildOptions (dict "params" $esbuildParams) -}}
|
2024-03-08 11:43:44 +01:00
|
|
|
{{- $searchJs := resources.Get "js/search.js" | js.Build $esbuildOptions | resources.Copy (path.Join $targetDocsJSPath "/assets/js/search.js") }}
|
2024-03-08 11:53:43 +01:00
|
|
|
<script defer src="{{ $searchJs.RelPermalink }}"></script>
|
2024-03-08 11:43:44 +01:00
|
|
|
{{- end -}}
|
2022-04-12 17:07:25 +02:00
|
|
|
|
2024-03-08 11:43:44 +01:00
|
|
|
{{ if eq .Page.Layout "docs" -}}
|
|
|
|
{{- /* Disable minify options for snippets.js so that the file's readable on StackBlitz */ -}}
|
|
|
|
{{- $snippetsFile := resources.Get "js/snippets.js" | js.Build (merge $esbuildOptions (dict "minify" "false")) -}}
|
|
|
|
{{- $esbuildParams := dict
|
|
|
|
"cssCdn" .Site.Params.cdn.css
|
|
|
|
"jsBundleCdn" .Site.Params.cdn.js_bundle
|
|
|
|
"docsVersion" .Site.Params.docs_version
|
|
|
|
"jsSnippetFile" $snippetsFile.Content
|
|
|
|
-}}
|
|
|
|
{{- $esbuildOptions = merge $esbuildOptions (dict "params" $esbuildParams) -}}
|
|
|
|
{{- $stackblitzJs := resources.Get "js/stackblitz.js" | js.Build $esbuildOptions | resources.Copy (path.Join $targetDocsJSPath "/assets/js/stackblitz.js") }}
|
2024-03-08 11:53:43 +01:00
|
|
|
<script defer src="{{ $stackblitzJs.RelPermalink }}"></script>
|
2024-03-08 11:43:44 +01:00
|
|
|
{{- end -}}
|