YSlow 'Put CSS at the top' Bug

And a workaround.

It looks like YSlow v0.9.5b2 has a bug regarding the way it grades CSS. Basically, any file included using @Import is interpreted by YSlow as an external file. There is some discussion about this bug on the Yahoo developers page here. One interesting point brought up by a commenter is that IE renders @Import files differently than other browsers, but I wasn't able to find any information to back up that claim.

As far as I can tell it shouldn't make any difference whether local CSS files are included using @Import or <link rel="...">. So, unless you are looking for a perfect score it should be okay to leave the @Imports where they are.

Steve Souders wrote up a very informative post concerning this issue. Basically, if you mix and match link tags and @import tags they will be loaded serially by the browser instead of in parallel. So, if you stick to just one method then everything should be okay.


Add your comment

No HTML. Line breaks and URLs will automatically be converted.

(private)