Hey @disagree
Thanks so much for taking the time to share your thoughts.
You are quite correct. In the the Standard Edition / Guest API, combine JS is not currently one of the available features. I’ll explain why.
When combining JS, one option is to inject the entire JavaScript into the body of the page which causes a much larger initial document. While this means that the JS will parse early, it also means that the JS will not be cached and so every page load will be longer.
The other option is to bundle all of the JS (including inline) into a separate file, and then make a single call to that file at the end of the document. Unfortunately, browser caching of this file will only affect subsequent loads of the home page, and the parsing and execution of the JS is delayed. I believe this is how Autoptimize does it.
When JS is not combined, but deferred properly, the JS files can be properly cached so that on any subsequent page request, all JS is available immediately. Also, it means that the JS will execute in order which will often mean the above-the-fold content will render faster.
I agree, having many JS requests is reported as an issue with tools such as Pingdom and GTMetrix, however we always have to consider the larger scope of what is going on in the page as well. And, with HTTP2 being supported by more and more web hosts, many of those resource requests can be loaded in parallel which have a faster load time than if the JS were in a single combined file. Having JS combined by default may have been a feature that we would have considered enabled by default a few years back, but not so much now. In addition, we’ve found that when combining JS, the JS can have troubles parsing in some sites.
When I developed Pegasaas, I felt it was more important to make a plugin that applied the “best case” scenario without requiring features to be turned off or on. The Guest API access is designed so that it’s a “one and done”.
But, I admit, there are those websites that may respond better with more expert level configurations. We do have a premium version which allows for more fine-grained configurations, although the ability to combine JS is not a separate feature at this time but is actually a part of an advanced version of deferral of render blocking JS resources.
But I will consider having the JS combination broken out into it’s own feature though — for those who feel it will have a better impact on their site.
Again, I appreciate you taking the time to share your observations.
Best regards,
Brandon Devnich
Pegasaas
-
This reply was modified 5 years, 5 months ago by Pegasaas.