{{ $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) }}