hugo-theme-more-contentful/assets/templates/heroicon.svg
Gabriel Arazas 2aeb76fe93 Update icon templates
The icon templates are pretty limited to what I want to do. This is also
nice for those who are extending the theme with easy-to-use functions.
2023-04-03 11:42:09 +08:00

10 lines
374 B
XML

{{- /*
This template applies an ID to an SVG from the Heroicons set to be used with `<use>` element.
*/ -}}
{{- $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 }}
{{- replaceRE $match $replaceWith $icon.Content | safeHTML -}}