Inlines CSS styles into a Premailex.html_tree/0.
Summary
Functions
Adds inline styles from CSS rules (t:CSSParser.rule/0) to a
Premailex.html_tree/0.
Functions
@spec process(Premailex.html_tree(), [Premailex.CSSParser.rule()]) :: Premailex.html_tree()
Adds inline styles from CSS rules (t:CSSParser.rule/0) to a
Premailex.html_tree/0.
Examples
iex> tree = Premailex.parse(~s(<html><head><style>p{background-color: #fff;}</style></head><body><p style="color: #000;">Text</p></body></html>))
iex> css_rules = Premailex.CSSParser.parse("p{background-color: #fff;}")
iex> Premailex.HTMLInlineStyles.process(tree, css_rules)
[
{"html", [],
[
{"head", [], [{"style", [], ["p{background-color: #fff;}"]}]},
{"body", [], [{"p", [{"style", "background-color: #fff; color: #000;"}], ["Text"]}]}
]}
]