为什么许多网站缩减CSS和JavaScript而不是HTML? [英] Why do many sites minify CSS and JavaScript but not HTML?

查看:187
本文介绍了为什么许多网站缩减CSS和JavaScript而不是HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Possible Duplicate:
Why minify assets and not the markup?





I have seen a lot of sites using minified CSS and JavaScript to increase website response time but I have never seen any sites use minified HTML. Why would you not want your HTML to be minified?

推荐答案

因为如果你正在做的事情你正在服务HTML gzipped无论如何,所以HTML缩小 - 空格 - 的低调的果实不是所有的相关。没有很多简单的目标(例如变量名)在HTML中缩小,它们存在于CSS和JavaScript中。 HTML的大部分内容是页面的实际内容,可能无法缩小(而且,正如其他人指出的,它几乎肯定会比您的CSS或JS更频繁地变化)。

Because if you're doing things properly you're serving HTML gzipped anyway, so the low-hanging fruit of HTML minification - whitespace - isn't all that relevant. There aren't lots of easy targets (e.g. variable names) for minification in HTML, which are present in CSS and JavaScript. Much of the content of HTML is the actual content of the page, which probably can't be minified (and, as others have pointed out, will almost certainly vary more frequently than your CSS or JS).

这篇关于为什么许多网站缩减CSS和JavaScript而不是HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆