Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Does Linking an External Stylesheet Slow Down Website Load Time? Re: Does Linking an External Stylesheet Slow Down Website Load Time?

#132409
CrocoDillon
Participant

Yesterday they released jQuery 2.0, and on their blog they linked to an interesting [article](http://encosia.com/the-crucial-0-in-google-cdn-references-to-jquery-1-x-0/).

That article is about jQuery but the information about caching applies to your case as well. The most interesting part is this:

> When you’re dealing with large assets, a 304 response can save significant amounts of download time. Unfortunately, with a file as small as jQuery, the ceremony necessary to retrieve that 304 response is nearly as time consuming as just downloading the file in the first place.

jQuery is a pretty large file compared to your CSS file (probably), so I think this is what Chris means by it’s more complicated than that. The solution is far future caching, which eliminates the 304 ‘handshake’. The only downside is that you need to rename the file on every update you make, otherwise users who have the cached version won’t see the update. (some people suggest added a query to the CSS url like `global.css?v=1.2`, but it turns out proxies won’t cache that, so `global.v1.2.css` would be better)