Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchenlianghong <clh021@gmail.com>2022-01-19 18:35:15 +0300
committerGitHub <noreply@github.com>2022-01-19 18:35:15 +0300
commitbfd1eb84003cd1e364ca3fb288250247a46cf633 (patch)
treedcc60a4d9f6e4e6d4e634b0d9b3270999ee45e74
parenteebaea81e82557663a8a0832d59d07ff531f4664 (diff)
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>
-rw-r--r--layouts/partials/footer/components/script.html8
1 files changed, 7 insertions, 1 deletions
diff --git a/layouts/partials/footer/components/script.html b/layouts/partials/footer/components/script.html
index 83522ff..4cb350c 100644
--- a/layouts/partials/footer/components/script.html
+++ b/layouts/partials/footer/components/script.html
@@ -3,4 +3,10 @@
{{- $opts := dict "minify" hugo.IsProduction -}}
{{- $script := resources.Get "ts/main.ts" | js.Build $opts -}}
-<script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script> \ No newline at end of file
+<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 -}} \ No newline at end of file