mirror of
https://github.com/foo-dogsquared/hugo-theme-more-contentful.git
synced 2025-02-07 06:19:03 +00:00
Simplify Heroicon SVG template
This commit is contained in:
parent
7ea6088f86
commit
1eb8a3b600
@ -1,9 +1,8 @@
|
||||
{{- /*
|
||||
This template applies an ID to an SVG from the Heroicons set to be used with `<use>` element.
|
||||
*/ -}}
|
||||
{{- $match := "<svg (.*)?>\\s*(.*)\\s*</svg>" }}
|
||||
{{- $match := "^\\s*<svg (.*)?>" }}
|
||||
{{- $icon := resources.Get (printf "svg/heroicons/24/solid/%s.svg" .) }}
|
||||
{{- $replaceWith := printf `<svg id="%s" ${1}>${2}</svg>` . }}
|
||||
|
||||
{{- replaceRE $match $replaceWith $icon.Content | safeHTML }}
|
||||
{{- $replaceWith := printf `<svg id="%s" ${1}>` . }}
|
||||
|
||||
{{- replaceRE $match $replaceWith $icon.Content | safeHTML -}}
|
||||
|
Loading…
Reference in New Issue
Block a user