Minify CSS and JavaScript Files in WordPress

If your WordPress website is running slowly the main reason can be CSS and JavaScript files. The primary reason you should minify your WordPress files is to increase your website’s speed. Minify reduces the size of your files since the smaller the file, the easier and faster your website loads and displays pages. When running a PageSpeed Insights report, you may have noticed the following recommendations: “Minify CSS” and “Minify JavaScript”. Minification literally means stripping out unneeded parts of CSS and JavaScript files to make them more compact.

Make Your Files Lighter with WP Rocket

Minify CSS and JS Files in WordPress

Minify Your Ressources
WP Rocket automatically removes white space and comments from code. This makes the file size smaller, therefore faster to load.

You’ll find this option in the WordPress File Optimization tab, just tick Minify JavaScript and Minify CSS. It is as simple as it seems!

No effort or technical knowledge is required.


Take Advantage of GZIP Compression
GZIP compression is another important feature to reduce your file size and improve the overall loading time of your page. It will compress web pages on the server and decompress them in the browser.

GZIP compression is automatically enabled when you install WP Rocket.

You will benefit from better loading times right away!

Minify CSS and JS Files in WordPress

Minify CSS and JS Files in WordPress

Skyrocket your PageSpeed Scores
Reducing the size of JS and CSS files is one of the best ways to improve the loading time of your WordPress site and increase page performance.

On top of that, you should also see a well-improved page experience and thus better PageSpeed Insights scores – including Core Web Vitals.

See the Results for Yourself
Are you still wondering how WP Rocket can improve the performance of your site?
Check out the speed tests!

Performance without WP Rocket

Step #1 – Performance without WP Rocket

The overall performance is not so great, with a 69/100 grade.

The recommendations from Lighthouse are related to optimizing CSS and JS, including its minification.


Step #2 – Minification and GZIP compression by WP Rocket

After activating WP Rocket, we can see some instant improvements, namely:

The “Minify CSS” and “Minify JS” issues have been solved.
Warnings about caching and compression are also fixed because WP Rocket automatically enables page and browser caching, and GZIP compression.
Thanks to minification, the overall performance went from 69/100 to 82/100 and the LCP score is now in orange.

Minification and GZIP compression by WP Rocket

Minification, compression, plus other advanced options by WP Rocket

Step #3 – Minification, compression, plus other advanced options by WP Rocket


In addition to the minification features, we enabled the following WP Rocket options:

Remove unused CSS
Load JavaScript deferred
Delay JS execution
The overall performance grade improved to 97/100 and all Core Web Vitals went green

On top of its default features that will make your site faster in a blink (page caching, browser caching, or GZIP compression), WP Rocket offers a set of advanced options to boost your performance even more, including minification, delay JavaScript execution, remove unused CSS, and LazyLoad.

Related Posts

Leave a Reply

Your email address will not be published.