I am writing an e-mail HTML template, and some e-mail clients do not support <style>
for specifying CSS. The only alternative for applying CSS is to use inline styles (style
attribute). Is there a tool or library (Node.JS) for applying a stylesheet to some HTML and getting back the HTML with the styles applied?
The tool does not have to support many selectors; id, class, and element name selectors should be sufficient for my needs.
Example of what is needed:
// stylesheet.css
a { color: red; }
// email.html
<p>This is a <a href="http://example.com/">test</a></p>
// Expected result
<p>This is a <a href="http://example.com/" style="color: red;">test</a></p>