php 类到内联 css 样式?
我在 MailChimp 的 css inliner http://www.mailchimp.com/labs/inlinecss.php< /a> 我想知道是否有任何类可以做到这一点,我希望将其放在我的电子邮件代码中,而不是一直到 MailChimp。
基本上我正在寻找页面后面的代码或非常类似的东西。
干杯。
I was over at MailChimp's css inliner http://www.mailchimp.com/labs/inlinecss.php and I was wondering if there are any classes out there that can do this, I'd love to have it in my email code instead of going all the way over to MailChimp.
Basically I'm looking for the code, behind the page or something very similar.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这怎么样?
https://www.myintervals.com/emogrifier.php
“... Emogrifier 自动变形通过解析 CSS 并根据 CSS 选择器将 CSS 定义插入到 HTML 中的标签中,您可以使用下面的表单来粘贴 HTML 或 CSS,或者如果您更倾向于技术,则可以下载 PHP。源代码并在您自己的应用程序中使用它。
How's this?
https://www.myintervals.com/emogrifier.php
"... Emogrifier automagically transmogrifies your HTML by parsing your CSS and inserting your CSS definitions into tags within your HTML based on your CSS selectors. You can either use the form below to paste your HTML or CSS, or if you're more technically inclined, you can download the PHP source code and use it in your own applications. "
今晚我在寻找同样的东西,我找到了这个库 https://github.com/christiaan/InlineStyle ,这就是我认为你想要的。
它甚至可以理解像 ul > 这样的选择器。李等。
I was looking for the same thing tonight and I found this library https://github.com/christiaan/InlineStyle ,which does what I think you want.
It even understand selectors like ul > li and such.
您可以尝试Premailer。源代码可以在 Github 上找到。 (刚刚注意到您的标签是 PHP,Premailer 是 Ruby,所以这对您来说可能不算是真正的答案......)
You can try Premailer. The source is available on Github. (Just noticed your tag is PHP and Premailer is Ruby, so this might not count as a real answer for you...)
Emogrifier 不适合我,所以我开发了这个: https://github.com/djfm/cssin。我尝试过其他几个库,但没有一个对我的 HTML 文件起作用,我认为我的库相当不错。
Emogrifier did not work for me, so I have developed this: https://github.com/djfm/cssin. I've tried several other libs and none worked on my HTML files, my lib is pretty OK I think.
纯 PHP 解决方案: https://github.com/tijsverkoyen/CssToInlineStyles (由 laravel)。
tijsverkoyen/css-to-inline-styles
如果使用 作曲家。Pure PHP solution: https://github.com/tijsverkoyen/CssToInlineStyles (used by laravel).
tijsverkoyen/css-to-inline-styles
if using composer.OP 中的链接似乎消失了,但 MailChimp 免费提供样式到内联转换器,无需注册:
http://beaker.mailchimp.com/inline-css
不过,仍然必须“一路走到 Mailchimp”!
The link in the OP appears to be gone, but MailChimp offers a style-to-inline convertor for free with no signup here:
http://beaker.mailchimp.com/inline-css
Still have to go "all thet way over to Mailchimp", though!
我一直在寻找同样的东西(基于 PHP、可下载、开源),但找不到它,所以我为开源 ruby 库创建了以下代理/包装器: com/onassar/PHP-Premailer" rel="nofollow">https://github.com/onassar/PHP-Premailer
希望对您有所帮助。
I was looking for the same thing (PHP based, downloadable, open source), but couldn't find it, so I created the following proxy/wrapper for the open source ruby library: https://github.com/onassar/PHP-Premailer
Hope it's helpful.