开发者

How can I optimize http requests

Modern browsers support gzip/deflate compression and http pipelining, which helps speed up my page being loaded by the client's browsers.

开发者_运维百科

I came across a great technique for optimizing images, so I was wondering if there is a way to bundle css/js/html (the plain text) files together into a single stream so that my web pages can be delivered faster.

Your help is kindly appreciated.

Regards, Richard


There are several minification projects out there.

Google minify is one example.

Minification tends to not go as far as you are suggesting (bundling css/js/html into one stream), but combining all CSS into a single request and JS into a single request (as well as removal of insignificant whitespace and sometimes renaming of code to shorter variables).


I presume you've had a look at the excellent YSlow add-on for Firefox which gives some excellent tips on speeding up download times.

You can certainly combine js / css files on the server before being downloaded, but you wouldn't want to actually combine the html+js+css into a single stream. The simple reason for this is browser caching. The js and css files are only downloaded once, then your html is downloaded for every new page. If the js and css are combined into the html, then essentially every page is different and nothing be cached.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜