简体   繁体   English

在 email 开发中使用缩小的 HTML

[英]Using minified HTML in email development

What (if any) pitfalls would I encounter If I wanted to use minified HTML code for deployment as an email?如果我想使用缩小的 HTML 代码部署为 email,我会遇到什么(如果有)陷阱?

Wouldn't the use of minified code ensure proper rendering accross the majority of different clients given I took the necessary precautions in targeting the clients I intend to support?鉴于我在针对我打算支持的客户端采取了必要的预防措施,使用缩小代码是否不能确保在大多数不同客户端上正确呈现?

More specifically, trying to remedy issues like closures and white spacing in some versions of Outlook, etc. I live by properly formatted code, so hacking the beauty that is nicely formatted code seems like overkill if I could just minify it, deploy it, and call it a day..更具体地说,尝试解决 Outlook 等版本中的闭包和空白间距等问题。我以格式正确的代码为生,因此,如果我可以将其缩小、部署并今天就这样吧..

This will cause issues in various email clients. 这将导致各种电子邮件客户端出现问题。

In my experience, different webmail clients (Yahoo and Gmail in particular) will have issues with lines over a certain length (a couple hundred characters) and start behaving oddly - missing parts of the content, substituting in random characters, etc. 根据我的经验,不同的网络邮件客户端(特别是雅虎和Gmail)会遇到超过一定长度(几百个字符)的线路问题并开始表现奇怪 - 缺少部分内容,替换为随机字符等。

If this were to happen in the middle of HTML, it could be disastrous. 如果这发生在HTML的中间,那可能是灾难性的。

There is no good reason to minify HTML in an email - all of the issues with things like whitespace are well documented by people all over the internet and fixes are easily available. 没有充分的理由在电子邮件中缩小HTML - 所有与空白等内容相关的问题都得到了整个互联网上的人们的充分记录,并且修复很容易获得。

Minifying html email is at your own risk.缩小 html 电子邮件的风险由您自己承担。 When minifying it does alter the layout, particularly in Outlook.缩小时它确实会改变布局,尤其是在 Outlook 中。 From what I read minifying takes away comments and I need Outlook conditional comments to shape some of my emails.从我读到的缩小带走评论,我需要 Outlook 条件评论来塑造我的一些电子邮件。 I tested this in Litmus and Email on Acid...both testing platforms display distorted layouts in Outlook.我在 Litmus 和 Email on Acid 中对此进行了测试……这两个测试平台都在 Outlook 中显示扭曲的布局。 I literally went onto 20 different minify html/css online tools but all of them barely shrunk my file or in all cases distort my layout.我确实使用了 20 种不同的 minify html/css 在线工具,但它们几乎都没有缩小我的文件,或者在所有情况下都扭曲了我的布局。

HTML Crush is a minifier that is specifically built to compress HTML for email. HTML Crush 是一个压缩器,专门用于压缩 email 的 HTML。 The compression ratio won't be as efficient as other minfiers out there, but that's because it's careful about not breaking emails.压缩率不会像其他的 minfiers 那样有效,但那是因为它很小心不要破坏电子邮件。

https://www.codsen.com/os/html-crush/ https://www.codsen.com/os/html-crush/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM