hugo-theme-more-contentful/assets/templates/heroicon.svg
2022-10-24 12:59:05 +08:00

9 lines
334 B
XML

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