hugo-theme-more-contentful/assets/templates/heroicon.svg

10 lines
374 B
XML
Raw Normal View History

{{- /*
This template applies an ID to an SVG from the Heroicons set to be used with `<use>` element.
*/ -}}
2022-10-24 04:59:05 +00:00
{{- $match := "^\\s*<svg (.*)?>" }}
{{- $name := default .id .name }}
{{- $icon := resources.Get (printf "svg/heroicons/24/solid/%s.svg" .id) }}
{{- $replaceWith := printf `<svg id="%s" ${1}>` $name }}
2022-10-24 04:59:05 +00:00
{{- replaceRE $match $replaceWith $icon.Content | safeHTML -}}