mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 18:31:45 +01:00
feat: add custom.ts (#461)
* 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>
This commit is contained in:
parent
eebaea81e8
commit
bfd1eb8400
1 changed files with 7 additions and 1 deletions
|
@ -4,3 +4,9 @@
|
|||
{{- $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 -}}
|
Loading…
Reference in a new issue