chore(partials): refactor partials
This commit is contained in:
22
layouts/partials/plugin/icon.html
Normal file
22
layouts/partials/plugin/icon.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{- $type := index . "type" | default "fa" -}}
|
||||
{{- $classList := split (index . "class") " " -}}
|
||||
{{- $scratch := index . "scratch" -}}
|
||||
{{- /* Fork Awesome */ -}}
|
||||
{{- if eq $type "fo" -}}
|
||||
{{- $newClassList := slice -}}
|
||||
{{- range $classList -}}
|
||||
{{- if eq . "fa" -}}
|
||||
{{- $newClassList = $newClassList | append "fo" -}}
|
||||
{{- else -}}
|
||||
{{- $newClassList = $newClassList | append (replaceRE `^fa\-(.+)$` `fo-$1` .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $classList = $newClassList -}}
|
||||
{{- $scratch.Set "forkawesome" true -}}
|
||||
|
||||
{{- /* default is Font Awesome */ -}}
|
||||
{{- /* Others */ -}}
|
||||
{{- else if ne $type "fa" -}}
|
||||
{{- $scratch.Set "iconfont" true -}}
|
||||
{{- end -}}
|
||||
<i class="{{ delimit $classList ` ` }}"></i>
|
||||
Reference in New Issue
Block a user