Why not combine all js?

When gulp processes all js files inside “scripts” task it doesn’t combine all Javascript to one file. Instead it makes 3 files: main, jquery and customizer. Isn’t it better to combine them to just one so there will be less http requests?

jQuery is not added since it may have to be loaded in the header (for plugins that are naughty and like to spit out JavaScript inline somewhere in the middle of the page).

Customizer is a small file and is only used, well, in the customizer, so there is really no reason to load that with the main site’s JS.

Finally, with HTTP/2 around the corner, this won’t matter. However, if you really wanted to combine these files, you could just modify the manifest.json file and run gulp.

1 Like