{{- /* Icon renderer for Font Awesome classes and SVG sources. - Renders element when Class is provided. - Resolves local SVG resources or external SVG URL fallback. - Supports Simple Icons shorthand by icon name. @param {String} [.Class] icon class name for @param {String} [.Src] svg source path or URL @param {String} [.Simpleicons] simple-icons icon name @param {String} [.Prefix] custom prefix for simple-icons source path */ -}} {{- with .Class -}} {{- else -}} {{- $src := .Src -}} {{- with .Simpleicons -}} {{- $prefix := $.Prefix | default "lib/simple-icons/icons" | strings.TrimSuffix "/" -}} {{- $src = printf "%v/%v.svg" $prefix . -}} {{- end -}} {{- if not $src -}} {{- errorf "Icon src is missing: %s" templates.Current.Filename -}} {{- end -}} {{- if (urls.Parse $src).Host | not -}} {{- $resource := resources.Get $src | minify -}} {{ if not $resource }} {{- errorf "Icon does not exist %v" $src -}} {{- end -}} {{- $resource := $resource.Content -}} {{- $resource | replaceRE ` {{- end -}} {{- end -}}