BitstylesPhoenix.Classnames (bitstyles_phoenix v0.4.0) View Source
The very best of NPM, now for elixir.
Link to this section Summary
Link to this section Functions
Concatenates lists of class names, with trimming and conditionals.
e2e-
classes are trimmed at compile time. This can be disabled for
test environments via trim_e2e_classes
.
Examples
iex> classnames("foo")
"foo"
iex> classnames("e2e-out")
""
iex> classnames(nil)
""
iex> classnames(" foo ")
"foo"
iex> classnames(" foo bar ")
"foo bar"
iex> classnames(["foo", "bar"])
"foo bar"
iex> classnames(["foo", "bar baz"])
"foo bar baz"
iex> classnames(:foo)
"foo"
iex> classnames({"foo", 1 == 1})
"foo"
iex> classnames({"foo", 1 == 2})
""
iex> classnames([" foo boing ", {"bar", 1 == 2}, :baz])
"foo boing baz"
Extended classnames.
e2e-
classes are trimmed at compile time. This can be disabled for
test environments via trim_e2e_classes
.
Conveniently accepts a (whitespace-separated) string or a list. If the list contains any conditional expressions, they are evaluated at runtime.