What is Minification and When Do You Need it?
The term ‘minify’ is used to describe a method that makes your website file sizes smaller. It does this by removing white spaces, lines, and unnecessary characters from the source code.
Here is an example of normal CSS code:
After minifying the code it will look like this:
You may also minify PHP scripts, however this will have no effect on page load speed for your users. PHP is a server-side programming language, which means it operates on servers before anything is transmitted to the visitor’s web browser.
The benefit of minifying files is that they load faster, which improves WordPress speed and performance.
However, other experts argue that the performance gain for most websites is insignificant and not worth the effort. On most WordPress sites, minification merely reduces a few kilobytes of material. By optimising photos for the web, you may minimise the time it takes for a website to load.
If you’re interested in learning more,
We’ll go through three distinct choices for you to consider:
Ready? Let’s begin with our most highly suggested way.
This technique is simpler and should be used by all users. It works no matter which WordPress hosting service you choose.
The WP Rocket plugin must first be installed and activated. See our step-by-step guide on installing a WordPress plugin for more information.
WP Rocket is the most effective WordPress caching plugin available. It makes it simple to add caching to WordPress and boost website speed and page load times dramatically.
See our article on how to install and configure WP Rocket in WordPress for more information.
After activating WP Rocket, go to Settings » WP Rocket and select the ‘File Optimization’ option.
From here, you need to check the Minify CSS files option.
WP Rocket will then show you a warning that this could break things on your site. Go ahead and click on the ‘Activate Minify CSS’ button. You can always deactivate this option if it causes any issues with your website.
After that, don’t forget to click on the Save changes button to store your settings.
If you use SiteGround as your WordPress hosting provider, you may use SiteGround Optimizer to minify CSS files.
The SiteGround Optimizer plugin is a performance optimization tool that runs on their own platform. It works great with their Ultrafast PHP to speed up the loading of your site.
On your WordPress site, just install and activate the SiteGround Optimizer plugin. See our step-by-step guide on installing a WordPress plugin for more information.
After that, go to your WordPress admin sidebar and click on the SG Optimizer menu.
This will take you to SG Optimizer settings.
From here you need to click on the ‘Go To Frontend’ button under ‘Other Optimizations’.
On the next screen, you need to switch on the toggle next to the ‘Minify CSS files’ option.
That’s all! You can now empty your WordPress cache and visit your website to load minified versions of CSS and JS files.
This method is recommended for users who are not on SiteGround and not using WP Rocket.
First, you need to install and activate the Autoptimize plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Upon activation, you need to visit the Settings » Autoptimize page to configure the plugin settings.
After that, you need to scroll down to the CSS Options and check the box next to the ‘Optimize CSS code’ option.
Remember to click the Save Changes button to save your changes.