| 1 |
{{ $r := .r }} |
| 2 |
{{ $attr := .attributes | default dict }} |
| 3 |
|
| 4 |
{{ if hugo.IsDevelopment }} |
| 5 |
<link |
| 6 |
rel="stylesheet" |
| 7 |
href="{{ $r.RelPermalink }}" |
| 8 |
{{ template `render-attributes` $attr }}> |
| 9 |
{{ else }} |
| 10 |
{{ with $r | minify | fingerprint }} |
| 11 |
<link |
| 12 |
rel="stylesheet" |
| 13 |
href="{{ .RelPermalink }}" |
| 14 |
integrity="{{ .Data.Integrity }}" |
| 15 |
crossorigin="anonymous" |
| 16 |
{{ template `render-attributes` $attr }}> |
| 17 |
{{ end }} |
| 18 |
{{ end }} |
| 19 |
|
| 20 |
{{ define "render-attributes" }} |
| 21 |
{{- range $k, $v := . -}} |
| 22 |
{{- if $v -}} |
| 23 |
{{- printf ` %s=%q` $k $v | safeHTMLAttr -}} |
| 24 |
{{- else -}} |
| 25 |
{{- printf ` %s` $k | safeHTMLAttr -}} |
| 26 |
{{- end -}} |
| 27 |
{{- end -}} |
| 28 |
{{ end }} |