CSSerpent (csserpent v0.5.1) View Source
CSSerpent, the CSS parser.
Link to this section Summary
Link to this section Functions
Specs
parse(String.t(), any()) :: [CSSerpent.Rule.t()]
Parses CSS text from a string.
Example
iex> CSSerpent.parse("p { color: green }")
[
%CSSerpent.Rule{
identifier: nil,
props: [%{property: "color", value: "green"}],
raw: "p { color: green }",
rules: nil,
selector: "p",
source: nil,
value: nil
}
]
Specs
raw_css([CSSerpent.Rule.t()] | CSSerpent.Rule.t()) :: String.t()
Converts parsed CSS to raw CSS.
Example
iex> CSSerpent.raw_css(%CSSerpent.Rule{props: [%{property: "color", value: "green"}], selector: "p"})
"p{color:green}"
iex> CSSerpent.raw_css([%CSSerpent.Rule{props: [%{property: "color", value: "blue"}], selector: "p"}])
"p{color:blue}"