CSS/HTML最小化的最佳实践是什么?我正在寻找服务器端工具,以加快与浏览器的互动。
发布于 2009-09-01 23:53:49
看一看YUI Compressor
发布于 2009-09-02 00:00:47
最好的工具可能是服务器端压缩。您可以使用mod_deflate在Apache中全局启用此功能。只需确保加载了mod_deflate,并将以下代码放在httpd.conf文件的底部:
# mod_deflate for server-wide output compression.
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
#Header append Vary User-Agent env=!dont-vary然后,所有静态和动态内容都将压缩提供给支持它的浏览器。
我相信其他现代的web服务器也会支持这一点,你只需要看一看他们的文档就能知道如何启用它。
发布于 2009-09-01 23:52:33
GZip压缩是非常标准的,而且做得很好。
https://stackoverflow.com/questions/1365209
复制相似问题