Remove CSS and JS merging feature #3005
Replies: 5 comments
-
I don't use those features anymore for my customers so I'm not against removing it |
Beta Was this translation helpful? Give feedback.
-
The Magento team did only half the job. The idea of merging is not a bad one because it reduces the number of requests for each individual file, there are cases where I have also met moare than 50 CSS + JS files. File size reduction was no longer implemented, however, there are still functional extensions that implement both (Fooman, Apptrian). I use the feature to merge both CSS and JS files that are already minified by me. I encountered issues with the JavaScript files, I had to arrange them in a certain order in the layout file, but I did not encounter any other issues. There are still reports in StackExchange but no one has concretely shown what were the issues they faced. If you decide to remove the merge feature, an extension must be provided that can be added via Composer. I do not agree with the solution of depending on a CDN even if it is free. At the same time, it is a major change that must be announced so that everyone who still uses it can make the necessary changes. |
Beta Was this translation helpful? Give feedback.
-
Note that it actually is a bad idea nowadays to merge CSS/JS: https://isotropic.co/merge-and-minify-css-js-should-be-avoided-on-http-2-servers/ I'm finding that 3rd party tools can be very lazy in that they include their CSS/JS in every single Magento page, even though this is not necessary (usually it's only needed in certain areas or under certain conditions). We could also start fixing these 3rd party modules with a |
Beta Was this translation helpful? Give feedback.
-
More info on HTTP/2 and Magento here. But it's not so straight forward as described in the article. We received a bunch of 503 errors on js and css loading and a bunch of limiting requests, excess: 30.550 by zone "lreq" errors on the nginx server. |
Beta Was this translation helpful? Give feedback.
-
I would not rush to remove this feature from OpenMage. First of all, it is disabled by default in the Backend and its activation can only be done manually. Whoever will do it should test it first and solve any issues that arise. Secondly, it didn't create any trouble for me personally. I have it in production for more than 8 years in several online stores that I have not switched to HTTP/2 for good reasons. I read the reports over time in various forums, but I could not reproduce them. I used Fooman Speedster for a while until I created a way to run merge and minify on the server and creating only two JS and CSS files to reduce the number of requests from 130 to 60. I am not using CDN's and I don't want to see OpenMage depending on such services, whoever needs them can make the necessary changes. Thirdly, HTTP/1.1 versus HTTP/2. I don't want to go into technical details, but I am one who shared the criticisms of HTTP/2 at the time, being in complete agreement with what important developers, such as Poul Kamp, argued. If you have a web server that communicates with the outside and deals with encryption, it is fine to switch to HTTP/2, this protocol really has visible results. The situation becomes a little more complicated when you are dealing with a cluster of servers and you have to use load balancers. In the case of HTTP/1.1, I do SSL offloading in the load balancer and in the backend I have an unencrypted connection with webservers, I did not notice major loads on the CPU's. Things got complicated when I switched to HTTP/2. The CPU's on the webservers in the backend were permanently loaded. It is an issue that has been reported publicly by other people too. Fourthly, I use this merge feature both with HTTP/1.1 and with HTTP/2. I read the recommendations of those who said to avoid merging files in HTTP/2, in my case I didn't encounter any issues, but I didn't see any noticeable performance differences either. I decided to stay for a while with HTTP/1.1 and wait the wider implementation of HTTP/3. In the meantime, the issues reported related to HTTP/2 and load balancers will be solved. |
Beta Was this translation helpful? Give feedback.
-
It's an outdated practice, and it has lead to numerous bugs and issues over the years. In HTTP/2, multiple CSS/JS files are not a problem anymore.
A free CDN like Cloudflare can do the minifying of these assets.
Beta Was this translation helpful? Give feedback.
All reactions