Inline icons plugin, based on external packages (like heroicons).
First, install icons package.
go get github.com/kyoto-framework/icons
Then, use FuncMap during template creation or attach FuncMap to your existing one.
...
tmpl := template.Must(template.New("name").Funcs(icons.FuncMap).ParseGlob("templates/*.html"))
// or
func FuncMap() template.FuncMap {
return render.ComposeFuncMap(
...
icons.FuncMap(),
)
}
General signature: Icon(iconset, name, ...classes)
Usage in Go files:
icon1 := icons.Icon("heroicons-outline", "archive")
icon2 := icons.Icon("heroicons-outline", "archive", "class1 class2")
icon3 := icons.Icon("heroicons-outline", "archive", "class1", "class2")
Usage in templates:
{{ icon `heroicons-outline` `archive` }}
{{ icon `heroicons-outline` `archive` `h-6 w-6` }}