mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-12-18 03:17:49 +01:00
bfd1eb8400
* feat: add custom.ts * Load custom.ts only if it exists This change avoids loading an empty .js file Co-authored-by: Jimmy Cai <github@jimmycai.com>
12 lines
No EOL
540 B
HTML
12 lines
No EOL
540 B
HTML
{{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}}
|
|
|
|
{{- $opts := dict "minify" hugo.IsProduction -}}
|
|
{{- $script := resources.Get "ts/main.ts" | js.Build $opts -}}
|
|
|
|
<script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script>
|
|
|
|
{{- with resources.Get "ts/custom.ts" -}}
|
|
{{/* Place your custom script in HUGO_SITE_FOLDER/assets/ts/custom.ts */}}
|
|
{{- $customScript := . | js.Build $opts -}}
|
|
<script type="text/javascript" src="{{ $customScript.RelPermalink }}" defer></script>
|
|
{{- end -}} |