hugo-theme-next/layouts/partials/_funs/get_res.html
2022-10-30 16:54:38 +08:00

21 lines
468 B
HTML

{{/* Use to get resources path with vendor */}}
{{ $fmt := "%s/%s@%s/%s" }}
{{ $npm := .res.name }}
{{ with .res.alias2 }}
{{ $npm = . }}
{{ end }}
{{- $file := .res.file }}
{{- if ne .vendor "unpkg" }}
{{- with .res.alias }}
{{- $npm = . }}
{{- end }}
{{- $file = replaceRE `(dist|lib|source\/js)\/` "" .res.file }}
{{- $fmt = "%s/%s/%s/%s" }}
{{- end }}
{{ $pluginRes := printf $fmt .router $npm .res.version $file }}
{{ return $pluginRes }}