2022-05-25 11:02:05 +08:00
|
|
|
<!-- Plugin scripts files -->
|
2022-06-01 14:42:03 +08:00
|
|
|
{{- $jsRes := .Site.Data.resources.js }}
|
|
|
|
{{- $vendor := .Site.Params.vendors.plugins }}
|
2022-05-25 11:02:05 +08:00
|
|
|
{{- $vendorCDN := .Scratch.Get "pluginCDN" }}
|
|
|
|
{{- range $js := $jsRes }}
|
|
|
|
{{- $pluginJS := $vendorCDN }}
|
|
|
|
{{- $npm := $js.name }}
|
|
|
|
{{- $file := $js.file }}
|
|
|
|
{{- if eq $vendor "cdnjs" }}
|
|
|
|
{{- with $js.alias }}
|
|
|
|
{{- $npm = . }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $file = replaceRE `(dist|lib|source\/js)\/` "" $js.file }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $pluginJS = replace $pluginJS "${name}" $npm }}
|
|
|
|
{{- $pluginJS = replace $pluginJS "${version}" $js.version }}
|
|
|
|
{{- $pluginJS = replace $pluginJS "${file}" $file }}
|
2022-06-18 16:09:08 +08:00
|
|
|
<script type="text/javascript" src="{{ $pluginJS }}" defer></script>
|
2022-06-08 14:51:30 +08:00
|
|
|
{{- end }}
|
|
|
|
|
2022-06-18 16:09:08 +08:00
|
|
|
{{- $config := resources.Get "js/config.js" | resources.ExecuteAsTemplate "config.js" . }}
|
|
|
|
{{- $motion := resources.Get "js/motion.js" }}
|
|
|
|
{{- $boot := resources.Get "js/next-boot.js" }}
|
|
|
|
{{- $utils := resources.Get "js/utils.js" }}
|
|
|
|
{{- $nextjs := (slice $config $utils $boot ) }}
|
|
|
|
{{- if .Site.Params.motion.enable }}
|
|
|
|
{{ $motionjs := resources.Get "js/motion.js" }}
|
|
|
|
{{ $nextjs = $nextjs | append $motionjs }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if or (eq .Site.Params.shceme "Muse") (eq .Site.Params.shceme "Mist") }}
|
|
|
|
{{ $musejs := resources.Get "js/schemes/muse.js" }}
|
|
|
|
{{ $nextjs = $nextjs | append $musejs }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Site.Params.bookmark.enable }}
|
|
|
|
{{- $bookmarkjs := resources.Get "js/bookmark.js" }}
|
|
|
|
{{- $nextjs = $nextjs | append $bookmarkjs }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Site.Params.pjax }}
|
|
|
|
{{- $pjaxjs := resources.Get "js/pjax.js" }}
|
|
|
|
{{- $nextjs = $nextjs | append $pjaxjs }}
|
|
|
|
{{- end }}
|
|
|
|
{{- $nextjs = $nextjs | resources.Concat "js/hugo-next.js"}}
|
|
|
|
<script type="text/javascript" src="{{ $nextjs.RelPermalink }}" defer></script>
|