4

Google used to recommend webmasters to combine external CSS and JS files to improve the page speed. One of these pages was here: https://developers.google.com/speed/docs/best-practices/rtt#CombineExternalCSS Meanwhile it's been redirected and I can't seem to find a cached version of that page.

This recommendation it now seems to have disappeared from Google Guidelines and platforms like GTMetrix ("PageSpeed: Combine external CSS (deprecated)") and solutions providers like Kinsta ("How to Combine External CSS in WordPress") mention that this technique is deprecated.

Is it indeed deprecated and should we stop worrying about this (provided that the best practices are respected)?

4

It is still a good thing to do. Requesting files one by one adds extra delays like time to send the request and time to first byte (for each different request), which when all added together can result in an extra second (or more) of delay. That being said, separating your files in critical and not critical is also a good idea, downloading the critical ones first and all the rest after the page has loaded.

  • 2
    Thank you for your answer. Meanwhile I've done some more reading and there's a conclusion iterated by MOZ I'd like to quote, as it's completely relevant here: "We recommended that [you] enable HTTP/2 on your websites for better performance, but continue optimizing for HTTP/ 1.1. Your visitors will notice and thank you." Combining CSS/JS into fewer files, therefore, is still something that needs to be done for now. – Serge Jul 16 '18 at 9:11
2

At the rate that HTTP/2 adoption is growing (almost 30% of the top 10 million websites as of July 2018), I wouldn't put much effort into it. HTTP/2 frees you from having to deal with that sort of implementation detail. You need to make sure your host is capable of serving content through HTTP/2 to get the benefits.

From Wikipedia:

Websites that are efficient minimize the number of requests required to render an entire page by minifying (reducing the amount of code and packing smaller pieces of code into bundles, without reducing its ability to function) resources such as images and scripts. However, minification is not necessarily convenient nor efficient and may still require separate HTTP connections to get the page and the minified resources. HTTP/2 allows the server to "push" content, that is, to respond with data for more queries than the client requested. This allows the server to supply data it knows a web browser will need to render a web page, without waiting for the browser to examine the first response, and without the overhead of an additional request cycle.

Additional performance improvements in the first draft of HTTP/2 (which was a copy of SPDY) come from multiplexing of requests and responses to avoid the head-of-line blocking problem in HTTP 1 (even when HTTP pipelining is used), header compression, and prioritization of requests. HTTP/2 no longer supports HTTP 1.1's chunked transfer encoding mechanism, as it provides its own, more efficient, mechanisms for data streaming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.