vmems-website/layouts/partials/helpers/svg.html

8 lines
270 B
HTML
Raw Normal View History

2023-10-28 08:20:52 +00:00
{{ $svg := .path }}
{{ $match := `<svg((\s|\S)*)>((\s|\S)*)</svg>` }}
{{ $input := (printf "/assets/images/%s.svg" $svg | readFile) }}
{{ $replaceWith := printf `<svg class="%s" ${1}>${2}</svg>` .class }}
{{ return (replaceRE $match $replaceWith $input | safeHTML) }}