mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Merge commit 'b3d87dd0fd746f07f9afa6e6a2969aea41da6a38'
This commit is contained in:
28
docs/layouts/_partials/helpers/linkcss.html
Normal file
28
docs/layouts/_partials/helpers/linkcss.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{{ $r := .r }}
|
||||
{{ $attr := .attributes | default dict }}
|
||||
|
||||
{{ if hugo.IsDevelopment }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $r.RelPermalink }}"
|
||||
{{ template `render-attributes` $attr }}>
|
||||
{{ else }}
|
||||
{{ with $r | minify | fingerprint }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ .RelPermalink }}"
|
||||
integrity="{{ .Data.Integrity }}"
|
||||
crossorigin="anonymous"
|
||||
{{ template `render-attributes` $attr }}>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "render-attributes" }}
|
||||
{{- range $k, $v := . -}}
|
||||
{{- if $v -}}
|
||||
{{- printf ` %s=%q` $k $v | safeHTMLAttr -}}
|
||||
{{- else -}}
|
||||
{{- printf ` %s` $k | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ end }}
|
Reference in New Issue
Block a user