mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-22 23:08:17 +01:00
25 lines
1 KiB
HTML
25 lines
1 KiB
HTML
{{- if strings.HasPrefix .source "<link" -}}
|
|
{{- safeHTML .source -}}
|
|
{{- else -}}
|
|
{{- $href := .source -}}
|
|
{{- $integrity := .integrity -}}
|
|
{{- if (urls.Parse $href).Host | not -}}
|
|
{{- $res := resources.Get $href -}}
|
|
{{- with .template -}}
|
|
{{- $res = $res | resources.ExecuteAsTemplate . $.context -}}
|
|
{{- end -}}
|
|
{{- with .toCSS -}}
|
|
{{- $options := . | merge (dict "outputStyle" "compressed") -}}
|
|
{{- $res = $res | toCSS $options -}}
|
|
{{- end -}}
|
|
{{- if .minify -}}
|
|
{{- $res = $res | minify -}}
|
|
{{- end -}}
|
|
{{- with .fingerprint -}}
|
|
{{- $res = $res | fingerprint . -}}
|
|
{{- $integrity = $res.Data.Integrity -}}
|
|
{{- end -}}
|
|
{{- $href = $res.RelPermalink -}}
|
|
{{- end -}}
|
|
<link rel="stylesheet" href="{{ $href }}"{{ if .crossorigin }} crossorigin="anonymous"{{ end }}{{ with $integrity }} integrity="{{ . }}"{{ end }}{{ with .attr }} {{ . | safeHTMLAttr }}{{ end }}>
|
|
{{- end -}}
|