From bfd1eb84003cd1e364ca3fb288250247a46cf633 Mon Sep 17 00:00:00 2001 From: chenlianghong Date: Wed, 19 Jan 2022 23:35:15 +0800 Subject: [PATCH] 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 --- layouts/partials/footer/components/script.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -}} - \ No newline at end of file + + +{{- with resources.Get "ts/custom.ts" -}} + {{/* Place your custom script in HUGO_SITE_FOLDER/assets/ts/custom.ts */}} + {{- $customScript := . | js.Build $opts -}} + +{{- end -}} \ No newline at end of file