mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-15 11:33:20 +01:00
29 lines
1.1 KiB
HTML
29 lines
1.1 KiB
HTML
{{- if .content -}}
|
|
<style>
|
|
{{- .content | safeCSS -}}
|
|
</style>
|
|
{{- else 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 -}}
|