What is Minify and Why it is Beneficial?
Minification is a programming language that removes all unnecessary characters from source code without changing its functionality. These unnecessary characters usually contain “white space characters, new line characters, comments, and block delimiters”.
It defers on your theme quality. So, nothing to worry if you see both are said to Minify and it is better to get a Premium theme.
Before you make any change, take a backup of that file.
#1 Minify Code:
# 2 Willpeavy:
Willpeavy is another great tool to Minify HTML codes. This tool works the same way as minify code does. It Minifies HTML and any CSS or JS included in your markup. To use this tool, you just need to copy your code here and click on Minify.
Other HTML minifier tool, https://kangax.github.io/html-minifier/
Minify Using Autoptimize Plugin
If you are not familiar with such coding, then it’s better to use a plugin and recommended for beginners. So here comes the Autoptimize plugin for WordPress users.
Autoptimize Recommend Settings
You can easily do all stuff from plugin settings. After activating this plugin, go to Settings> Autoptimize. Click on the “Show advanced settings” button.
In the HTML section, check “Optimize HTML Code” and “Keep HTML comments” for faster performance.
In CSS section, enable “Optimize CSS Code”, “Also aggregate inline CSS”. You can also enable “Inline and Defer CSS” if you have minified CSS. Try this tool to minify your CSS and paste it in the box.
Enter your CDN URL in the “CDN Base URL” field. For example, ‘//cdn.example.com/’.
And last, enable “Save aggregated script/css as static file”. But make sure, your webserver can properly handle the compression and expiry.
After Minifying your code, don’t forget to check your site speed again. Then compare it with that past results. If your site getting some problem or doesn’t show properly, you may try to clear the Cache.
Minifying HTML, CSS and JS is beneficially for your site. It removes your code’s unnecessary characters and making them smaller that are browser friendly. This way you can improve your site loading speed.
- How to Leverage Browser Caching on WordPress
- How to Optimize WordPress Database Using WP-Sweep
- 7 Best Image Optimizer for WordPress 2017
- How to Easily Enable Gzip Compression in WordPress for Faster Loading