Search code examples
cssstylesheet

External Stylesheet seems slower than Internal on Blogger


I'm reading conflicting information on the web about external and internal stylesheets. I think the concept is that external stylesheets only get cached once, so in theory they should load faster than internal stylesheets? Is this true?

I've tested my Blogger blog on webpagetest with both types of stylesheets to see if there is any change.

When I exclusively use the internal stylesheet, Webpagetest says my homepage loads in 1.0 seconds.

When I exclusively use the external stylesheet, Webpagetest says my homepage loads in 1.2 seconds.

Am I missing something here, such as that the external stylesheet may take longer to load on the first page, but subsequent pages are loaded much faster than using an internal stylesheet?

Yeah, I'm obsessed learning about this stuff. :)


Solution

  • Yes, that is correct.

    Using an external style sheet means that there is another request when the first page loads, so it will be slightly slower than an internal style sheet, but once the file is in the browser cache the page loads will be faster.

    Generally you should try to have as few requests as possible, but on the other hand you should try to reuse resources that can be cached, and that is only possible if they are separate requests.