Hacker News new | ask | show | jobs
by MrJohz 808 days ago
I went in the same direction for the return of my own blog that I'm doing at the moment. My logic was much the same as in the article: most users to a blog have probably found it via Google or a link aggregator, and probably won't have the site in cache. They will probably visit one, possibly two pages, so they're unlikely to get much of a benefit from caching resources once they arrive. Therefore the (amortised) connection cost for fetching the CSS resource is still going to be further for most users than the extra few kB of inline CSS.

It was also very easy to do - the static site generator I was using could still read the source CSS file and insert it into the template, just instead of inserting it as a link, I told it to insert the (minified and CSS-escaped) source into a style tag instead. I even had it set up so that it could create the link in dev-mode, and the style tag in production, although I think that was overkill!

The impact on site traffic is really interesting to see here, though. That surprised me a lot, that it would have such a measurable effect. I'm always surprised that other sites just don't seem to care about these sorts of things, and then produce painfully slow sites, usually full of ads.