Is there any proper wordpress way of including the JS and CSS through one merged URL?
So that instead of loading in x number of separate calls for each JS asset, it can be all merged into one URL? Samething for CSS.
I know this is easy enough to do using straight up PHP, but I wanted to check if wordpress has some nifty way of combining requests.
WordPress core has not such a mechanism. I’ve seen Caching plugins who do this. One of them is Semiologic Cache (WordPress Pluin) and there are probably others who do this as well.
The reason this is not automated is because it would wreak havoc on sites. Many plugins, themes, etc have multiple CSS/JS files that conflict when merged.
With a plugin like the one mentioned above you basically have to add the files manually one by one, and see if it breaks anything.
The alternative, which is a way better method but time consuming, is to look into the syntax yourself and combine them manually to avoid conflicts.
It is interesting that while WP is capable of and does use script concatenation in admin area – it is not exposed or suggested to be used in site itself.
I suppose with some tinkering it might be possible to make use of core, but it is way easier to make use of existing plugins.
I use W3 Total Cache, it has extensive CSS/script concatenation support.
You can also try the plugin autoptimize that does exactly that. It is well supported and easy to set up.