What is minification?
Minification is the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser. E.g code comments, formatting, removing unused code, using shorter variable and function names etc.. This process makes JS files smaller and small files consume less time/bandwidth to download.
What is combine?
The combine is the process that puts all JS files together and serves and executes them as a single file. Therefore, it reduces the number of HTTP requests.
Since HTTP/2 supports multiplexing, it’s not necessary to use this option on the servers that use HTTP/2.
How does PoweredCache JS minification/combine works?
JS optimization works with the JS files that are registered/enqueued properly. It replaces the original assets URL to passing through the optimizer file. When the combine is enabled, it passes multiple files and adds “minify” parameter which determines whether minify or not minify the file.
In order to work perfectly, there are some cases that the files that will be excluded from the JS combine:
- JS files that uses other than .js extension
- JS files that depends on inline content (such as JS translations)
- react and react-dom handlers (used by the WordPress core)
- External JS files
- Excluded JS files
Controlling Combine Programmatically
Concatenation logic can be controlled through “powered_cache_fo_js_do_concat” filter.