Skip to content

Commit

Permalink
perf: cache partials to improve build performance (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jan 9, 2024
1 parent bd918c4 commit 4226c71
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions layouts/partials/hb/modules/social-share-buttons/buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{- $icons := default true $params.icons }}
{{- $labels := default true $params.labels }}
{{- $size := default "1.25em" $params.size }}
{{- $media := partial "hb/modules/social-share-buttons/functions/media" . }}
{{- $media := partialCached "hb/modules/social-share-buttons/functions/media" . }}
{{- range default slice $params.media }}
{{- $name := . }}
{{- $label := default (title $name) (printf "social_share_button_%s" $name | i18n) }}
Expand All @@ -16,14 +16,15 @@
title="{{ $label }}"
href="{{ $url }}">
{{- if $icons }}
{{- partial "icons/icon" (dict
{{- $icon := dict
"vendor" "simple"
"name" (default $name .icon)
"width" $size
"height" $size
"color" (default "" .iconColor)
"className" (cond $labels "hb-social-share-button-icon me-1" "hb-social-share-button-icon"))
"className" (cond $labels "hb-social-share-button-icon me-1" "hb-social-share-button-icon")
}}
{{- partialCached "icons/icon" $icon $icon }}
{{- end }}
{{- if $labels }}
<span class="hb-social-share-button-label">{{- $label -}}</span>
Expand Down

0 comments on commit 4226c71

Please sign in to comment.