mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-15 19:36:20 +01:00
21 lines
952 B
HTML
21 lines
952 B
HTML
{{- if strings.HasPrefix .source "<script" -}}
|
|
{{- safeHTML .source -}}
|
|
{{- else -}}
|
|
{{- $src := .source -}}
|
|
{{- $integrity := .integrity -}}
|
|
{{- if (urls.Parse $src).Host | not -}}
|
|
{{- $res := resources.Get $src -}}
|
|
{{- with .template -}}
|
|
{{- $res = $res | resources.ExecuteAsTemplate . $.context -}}
|
|
{{- end -}}
|
|
{{- if .minify -}}
|
|
{{- $res = $res | minify -}}
|
|
{{- end -}}
|
|
{{- with .fingerprint -}}
|
|
{{- $res = $res | fingerprint . -}}
|
|
{{- $integrity = $res.Data.Integrity -}}
|
|
{{- end -}}
|
|
{{- $src = $res.RelPermalink -}}
|
|
{{- end -}}
|
|
<script type="text/javascript" src="{{ $src }}"{{ if .crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ if .async }} async{{ end }}{{ if .defer }} defer{{ end }}{{ with .attr }} {{ . | safeHTMLAttr }}{{ end }}></script>
|
|
{{- end -}}
|