#98: replacing readFile with partial for predefined icons

This approach has been taken from another popular hugo-theme `ananke`:
e3f7fbe39d/layouts/partials/social-follow.html (L41)
This commit is contained in:
Maksim Iakunin 2021-09-30 18:35:35 +03:00
parent 9ca723f576
commit 3905dee767
No known key found for this signature in database
GPG Key ID: 629DE6EA48DAF1F4
16 changed files with 5 additions and 5 deletions

View File

Before

Width:  |  Height:  |  Size: 754 B

After

Width:  |  Height:  |  Size: 754 B

View File

Before

Width:  |  Height:  |  Size: 524 B

After

Width:  |  Height:  |  Size: 524 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 684 B

View File

Before

Width:  |  Height:  |  Size: 417 B

After

Width:  |  Height:  |  Size: 417 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 556 B

View File

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 460 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 869 B

View File

Before

Width:  |  Height:  |  Size: 730 B

After

Width:  |  Height:  |  Size: 730 B

View File

@ -1,15 +1,15 @@
<span class="inline-svg" >
{{ $dict := newScratch }}
{{ if (eq .custom true) }}
{{ $dict.Set "filename" (print "static/fa-icons/" .iconName ".svg") }}
{{ if (eq .custom true) }}
{{ $dict.Set "svg" (readFile (print "static/fa-icons/" .iconName ".svg")) }}
{{ else }}
{{ $dict.Set "filename" (print "themes/anubis/static/fa-icons/" .iconName ".svg") }}
{{ $dict.Set "svg" (partial (print "fa-icons/" .iconName ".svg")) }}
{{ end }}
{{- $path:="<path" -}}
{{- $fill:="<path fill=\"currentColor\"" -}}
{{ replace (readFile ($dict.Get "filename")) $path $fill | safeHTML }}
{{ replace ($dict.Get "svg") $path $fill | safeHTML }}
</span>