What is the CSS/JS minification?
You heard many times that "minification" dramatically improves site speed and accessibility. And, when it is done properly, that is true indeed.
So, what does minification mean?
The simplest answer is that a minification tool usually removes whitespace, strips comments, combines files, and optimizes/shortens a few common programming patterns - based on a specific algorithm.
In the case when your website was created on WordPress, this means that you'll have the possibility to use different optimization plugins with minification tools (Autoptimize, WP Rocket, WP Super Cache, WP Fastest Cache, etc). Since these plugins are developed by different companies, each of them has a unique minification algorithm. That's why different optimization plugins have different effects on the same site.
In order to minify properly the JS/CSS files of your website, it is needed to have really good knowledge about the code that is written there. As it was stated above, a minification tool removes parts of code that may seem insignificant for the whole site, based on a specific algorithm. Since each algorithm is unique, there are different parts of the code that will be leftover. The removed code may be crucial for your website and when left out, some aspects of the site may break (forms not appearing, images looking bad, buttons not working, etc). This does not mean that the minified theme or plugin has badly written code, but that the optimization plugins may not support some frameworks that are used in those plugins and themes. Again, that's why different optimization plugins have different effects on the same site or on two different sites hosted on the same server.
How do you minify them properly then?
There are two possible methods:
- Don't do it. If you are not familiar with the source code, then there is a high risk that the minification process will break the site.
- At your own risk, you could try to test a few plugins with different enabled options and if you see that a specific function breaks your website, the best is to disable it.
It's important to note that all of our themes and plugins are minified at the development stage. This means that you already have a minified version of our themes and plugins. Since the files are already properly minified by our team, during a second minification there is a high chance that the site will get broken, this is why we always recommend being careful when it comes to optimization plugins.
If anything goes wrong, just disable that setting/plugin overall.