Use partialCached on icon partial

This commit is contained in:
BBaoVanC 2022-05-02 21:11:38 -05:00
parent fa5c014a1b
commit cba6dd0a2f
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
2 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1 @@
{{- $icon_resource := resources.Get (printf "jam/icons/%s.svg" .) -}}
{{- $icon := $icon_resource.Content -}}
{{- $icon = replaceRE `<svg` `<svg class="icon"` $icon -}}
{{- $icon = replaceRE `</svg>` (printf `<title>%s icon</title></svg>` .) $icon -}}
{{- $icon = replaceRE `(width|height)="[0-9]*"` "" $icon -}}
{{- $icon | safeHTML -}}
{{ partialCached "icon_code.html" . . }}

View File

@ -0,0 +1,6 @@
{{- $icon_resource := resources.Get (printf "jam/icons/%s.svg" .) -}}
{{- $icon := $icon_resource.Content -}}
{{- $icon = replaceRE `<svg` `<svg class="icon"` $icon -}}
{{- $icon = replaceRE `</svg>` (printf `<title>%s icon</title></svg>` .) $icon -}}
{{- $icon = replaceRE `(width|height)="[0-9]*"` "" $icon -}}
{{- $icon | safeHTML -}}