2020-04-15 09:46:50 +02:00
|
|
|
{{- if strings.HasPrefix .source "<link" -}}
|
|
|
|
{{- safeHTML .source -}}
|
2020-03-09 13:25:55 +01:00
|
|
|
{{- else -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- $href := .source -}}
|
|
|
|
{{- $integrity := .integrity -}}
|
|
|
|
{{- if strings.HasPrefix $href "http" | not -}}
|
|
|
|
{{- $res := resources.Get $href -}}
|
|
|
|
{{- with .template -}}
|
|
|
|
{{- $res = $res | resources.ExecuteAsTemplate . $.context -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with .toCSS -}}
|
|
|
|
{{- $options := . | merge (dict "outputStyle" "compressed" "enableSourceMap" true) -}}
|
|
|
|
{{- $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 }}>
|
2020-03-09 13:25:55 +01:00
|
|
|
{{- end -}}
|