Most people find out about minifying Javascript and CSS when they run their site speed test on GTMetrix.
Sidenote: If you haven’t checked your site speed, you should do it after reading this article. Google is now ranking sites based on speed because we all know that people want sites to load as quickly as possible.
So, since minifying Javascript and CSS comes up on GTMetrix results, it must be important, right?
Well, let’s learn more about it to see if it is or not.
About Javascript (JS) and Cascading Style Sheets (CSS)
JS is the code for the parts of your site that are interactive. It’s what makes the site function and can be run client side or server side. (this simply means it can run locally on your computer, or on the site you are visiting)
CSS is what makes your website look pretty. In other words, it’s part of the overall visual design of your site.
Depending on the person or people who designed the WordPress theme you’re using, JS and CSS can be muddled with unneeded code. This is especially true if your theme includes many interactive elements you don’t necessarily need or want.
When you have excess coding, the site slows down. As the site loads, it needs to go through all of the coding in the theme even if it’s not what it needs to display the site.
Think of it has a traffic jam. You’re trying to get to your destination. On a Sunday, there’s not much traffic, so you get to your destination quickly. However, on Monday mornings, the traffic is so bad, you have to wait and go around it to get to your destination.
The same thing happens when you have clean JS and CSS coding.
At this point, you may be asking, “What does this have to do with minifying JS and CSS?”
Cleaning Up Code with Minification
Minification does exactly what it says – it minifies the code. Yes, it makes it mini. Or at least, it makes it more mini than it’s original form.
Stripping unneeded code from JS and CSS will make the file sizes smaller. This makes rendering the site much faster. There’s less that the site has to go through to display the information needed for the user.
How to Do It
An experienced website developer can minify JS and CSS coding to make your site faster. ONLY an experienced website developer should do it.
Remember, JS code is what makes your site function. If important coding is taken out of the file, the site will not load at all.
CSS is the design. If an important CSS code is removed from the file, a part of the site’s design won’t load correctly. This makes your site look bad.
If you take on this task yourself and don’t know what you’re doing, you may have to hire a web developer to fix it, which will likely end up costing you more. The web developer will not only have to identify what is missing in the coding, but then rewrite the code to fix it.
Plugins are an option. However, some settings in the plugins will do the same thing as you going into the files and deleting code. If you do not choose the right settings in the minification plugin tool, you may just end up with a non-functioning site.
This is a good time to remind you to always backup your site before making any changes to it. If you do, you can always revert your site back to its original setup even if you make a mistake.
Now that you know all about minifying JS and CSS, go ahead and contact Patrick. He can help you determine if your site needs it, and do it for you to ensure it’s done correctly.