Yatm (Yatm v0.1.0)

View Source

The high-level API.

Summary

Functions

Merges classes, provided as a string or a list, returning a string with conflicts resolved.

Functions

merge(classes)

Merges classes, provided as a string or a list, returning a string with conflicts resolved.

If a list is provided, anything that isn't a string is discarded. Non-string values might appear as the result of expressions intended to apply classes conditionally.

Examples

Conflicting classes that come last override the ones coming before:

iex> Yatm.merge("p-1 p-2")
"p-2"

Provide a string or a list of strings:

iex> Yatm.merge(["p-1", "p-2"])
"p-2"

Conditionally apply classes:

iex> Yatm.merge(["p-1", true && "p-2", false && "p-3"])
"p-2"

Anything that isn't a binary is ignored:

iex> Yatm.merge(["p-1", %{why: "do this"}, 42, "p-2"])
"p-2"