Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Performance: Should .css files be served through asset domains?

I am reading an article by CSS Wizardry regarding web optimization. http://csswizardry.com/2013/01/front-end-performance-for-web-designers-and-front-end-developers/

It is a great article. I suggest everyone reading it.

The article suggested that CSS is in the critical path and shouldn't be served through asset domains. This is because serving through a sub domain will incur DNS lookup which takes time. Critical path = the time between requesting the page and then actually seeing something.

Best practice dictates that you should shard lots of assets over subdomains but not for CSS.

However when I view the source code of a big website like Facebook or Apple, they are serving their CSS from a subdomain? Why are they doing that?

<link rel="stylesheet" href="http://static.ak.fbcdn.net/rsrc.php/v2/yz/r/Hwq5_AIg0hW.css" />
<link rel="stylesheet" href="http://static.ak.fbcdn.net/rsrc.php/v2/y-/r/UgmvVXsZ1MP.css" />
<link rel="stylesheet" href="http://static.ak.fbcdn.net/rsrc.php/v2/yY/r/uHqkbF3y3Er.css" />


<link rel="stylesheet" href="http://images.apple.com/global/styles/base.css" type="text/css" />
<link rel="stylesheet" href="http://images.apple.com/v/home/p/styles/home.css" type="text/css" />
<link rel="stylesheet" href="http://images.apple.com/v/home/p/styles/billboard.css" type="text/css" />
<link rel="stylesheet" href="http://images.apple.com/home/styles/home.css" type="text/css" />
like image 597
Vennsoh Avatar asked Jan 29 '13 23:01

Vennsoh


1 Answers

It might be that they have other areas of their front-end performance optimized, and they have all sorts of dedicated servers. For a cap like myself, I will take whatever gains I can on the front-end, because it's just me tweaking the rendering time, not a whole team of people.

I couldn't tell you why Apple and Facebook choose to make the decisions they do, but everything that I've put into practice from CSS Wizardry has helped me, so I'm not going to argue.

It looks like Facebook is serving from a separate domain, and Apple from a sub-domain.

like image 144
lockedown Avatar answered Oct 07 '22 22:10

lockedown