Simple utility for conditionally joining HTML class names together (based on JedWatson/classnames)
go get github.com/andrew4699/classnames
Note that classnames.B is shorthand for classnames.Build
...
import (
"github.com/andrew4699/classnames"
)
classnames.B("foo", "bar") // "foo bar"
classnames.B([]string{"foo", "bar"}, "duck") // "foo bar duck"
classnames.B(nil, "foo", []string{"bar"}, nil, nil, nil) // "foo bar"
myMap := classnames.Map{
"foo": true,
"bar": false,
"duck": true,
}
classnames.B(myMap) // "foo duck"
...