wp_enqueue_script + how to load JS or CSS in one URL merge call?

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.

Read More

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.

Related posts

Leave a Reply

4 comments

  1. 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.

  2. 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.