www/themes/LoveIt/layouts/partials/plugin/style.html

30 Zeilen
1,1 KiB
HTML

2020-05-28 14:55:57 +02:00
{{- 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 -}}