【发布时间】:2011-06-21 02:43:41
【问题描述】:
我正在编写一个电子邮件 HTML 模板,一些电子邮件客户端不支持 <style> 指定 CSS。应用 CSS 的唯一替代方法是使用内联样式(style 属性)。是否有工具或库 (Node.JS) 用于将样式表应用到某些 HTML 并获取应用了样式的 HTML?
该工具不必支持很多选择器; id、class 和元素名称选择器应该足以满足我的需要。
需要的示例:
// 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>
【问题讨论】:
标签: html css node.js stylesheet