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

10 lines
357 B
XML
Raw Normal View History

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