🔥 Refactor struct & code for loading 3rd scripts.

This commit is contained in:
凡梦星尘
2022-10-27 15:57:42 +08:00
parent 9160a33053
commit 0d1b00f7b0
21 changed files with 302 additions and 210 deletions

View File

@@ -0,0 +1,11 @@
{{/* Get third party js plugins resource */}}
{{ $pluginPath := printf "%s/%s/%s" "js/third-party" .class .plugin }}
{{ $targetPath := printf "js/%s" .plugin }}
{{ $plugin := resources.Get $pluginPath | resources.ExecuteAsTemplate $targetPath .ctx }}
{{ if hugo.IsProduction }}
{{ $plugin = $plugin | minify | fingerprint }}
{{ end }}
<script type="text/javascript" src="{{ $plugin.RelPermalink }}" defer></script>