{{ $path := "static/icons/outline/" }} {{ $filename := "" }} {{ $stroke := "" }} {{ $fill := "" }} {{ $color := "" }} {{ if reflect.IsMap . }} {{ $path = default $path .path }} {{ $filename = default .filename .icon }} {{ $stroke = .stroke }} {{ $fill = .fill }} {{ $color = .color }} {{ else }} {{ $filename = . }} {{ end }} {{ if not (strings.HasSuffix $filename ".svg") }} {{ $filename = printf "%s.svg" $filename }} {{ end }} {{ $svg := readFile (printf "%s%s" $path $filename) }} {{ if $stroke }} {{ $strokeVal := $stroke }} {{ if and (ne (strings.HasPrefix $stroke "#") true) (ne (strings.HasPrefix $stroke "var(") true) (ne $stroke "currentColor") (ne $stroke "inherit") (ne $stroke "none") }} {{ $strokeVal = printf "var(--bs-%s)" $stroke }} {{ end }} {{ $svg = replaceRE `stroke="[^"]*"` (printf `stroke="%s"` $strokeVal) $svg }} {{ $svg = replaceRE `stroke='[^']*'` (printf `stroke="%s"` $strokeVal) $svg }} {{ end }} {{ if $fill }} {{ $fillVal := $fill }} {{ if and (ne (strings.HasPrefix $fill "#") true) (ne (strings.HasPrefix $fill "var(") true) (ne $fill "currentColor") (ne $fill "inherit") (ne $fill "none") }} {{ $fillVal = printf "var(--bs-%s)" $fill }} {{ end }} {{ $svg = replaceRE `fill="[^"]*"` (printf `fill="%s"` $fillVal) $svg }} {{ $svg = replaceRE `fill='[^']*'` (printf `fill="%s"` $fillVal) $svg }} {{ end }} {{ if $color }} {{ $colorVal := $color }} {{ if and (ne (strings.HasPrefix $color "#") true) (ne (strings.HasPrefix $color "var(") true) (ne $color "currentColor") (ne $color "inherit") (ne $color "none") }} {{ $colorVal = printf "var(--bs-%s)" $color }} {{ end }} {{ $svg = replaceRE `(