Plugins

How to Minify CSS / JavaScript files in WordPress?

There is a one of a lot of methods to load faster your WordPress website. One of them is minifying WordPress CSS and JavaScript files. This quickly trick can speed up your website. In this tutorial, I will show you how to minify CSS and JavaScript files in WordPress.

Why I should minify my JavaScript and CSS files in WordPress?

Since a few years, is trend to more optimize websites for users. Google checking this parameter too to serve SERP (Search Engine Results Page) – so if you want to be high in SEO, think about optimize your WordPress website. “Minify” means reduce code. In this example, minifying is removing lines and spaces from JavaScript or CSS file to save a space in web browser.

Example:

Normal JS file:

function toCelsius(fahrenheit) {
return (5/9) * (fahrenheit-32);
}
document.getElementById("demo").innerHTML = toCelsius(77);

Minified JS file:

function toCelsius(a){return 5/9*(a-32)}document.getElementById("demo").innerHTML=toCelsius(77);

As you can see, we save a lot of place and script loading is shorter.

HOW TO: Minify JavaScript/CSS files in WordPress

If you want to minify yours WordPress files (css and javascript), you can use plugin called Better WordPress Minify. You need to download it and activate. After this, go to BWM Minify menu.

First two options are for interesting for you 🙂 If you want to minify JS files automatically, check first box. If you want to minify CSS files automatically, check second box. After changing options, click save options below. That is all! Since now, your WordPress will automatically minify JS and/or CSS files. This is so easy.

I think you now will know how to automatically minify CSS and JavaScript files in WordPress with simple plugin. If you have some problems, feel free to contact with me!

Leave a Comment

Your email address will not be published. Required fields are marked *