Skip to content

Commit

Permalink
perf: cache icon HTML output (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Jun 1, 2024
1 parent 6abd476 commit cbf1c8d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion layouts/partials/icons/icon.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{{- with $width -}}
{{ $attrs.Set "width" . -}}
{{- end -}}
{{- $attrsHTML := partial "icons/functions/svg-attrs-to-html" $attrs -}}
{{- $attrsHTML := partialCached "icons/functions/svg-attrs-to-html" $attrs $attrs.Values -}}
{{- $newSvg := printf "<svg %s>" $attrsHTML -}}
{{- replaceRE `<svg([^>])+>` $newSvg $icon.Content 1 | safeHTML -}}
{{- end -}}

0 comments on commit cbf1c8d

Please sign in to comment.