{"id":2071,"date":"2019-04-08T09:54:51","date_gmt":"2019-04-08T09:54:51","guid":{"rendered":"https:\/\/azoora.com\/blog\/?p=2071"},"modified":"2019-07-12T23:45:05","modified_gmt":"2019-07-12T23:45:05","slug":"how-to-minify-your-wordpress-sites-css-html-javascript","status":"publish","type":"post","link":"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/","title":{"rendered":"How to Minify Your WordPress Site\u2019s CSS, HTML &#038; JavaScript"},"content":{"rendered":"\n<p>Minification is a simple concept that is often recommended as a step towards speeding up your website. But the reality is, it frustrates many site owners no end when they attempt to minify their files and end up breaking their site.<\/p>\n\n\n\n<p>So what gives?<\/p>\n\n\n\n<p>Minification often requires a lot of experimentation. While there are many solutions available, how they behave will vary from site to site depending on what theme and plugins you are using.<\/p>\n\n\n\n<p>In this post, we\u2019ll explore what minification is, its benefits, and some of the more popular minification solutions available \u2013 both manual and plugins \u2013 to help point you to the right solution for your site.<\/p>\n\n\n\n<h2>What is Minification?<\/h2>\n\n\n\n<p>Websites are made up of a lot of different files. If you test your site speed with Google PageSpeed Insights, you might get the recommendation to minify your HTML, CSS and JavaScript files.<\/p>\n\n\n\n<p>The problem? As humans, we write the code contained in these files so we can read them, but computers don\u2019t care about characters like comments, formatting, white space and new lines. So when they come across these unnecessary characters in website files they ignore them.<\/p>\n\n\n\n<p>That\u2019s where minification comes into the picture. Minification is a programming term that basically means removing any unnecessary characters that aren\u2019t required for code to execute. Minification works by analyzing and rewriting code to reduce the overall size of your files, thereby reducing the total size of your site so it loads faster in the user\u2019s browser.<\/p>\n\n\n\n<p>For example, here\u2019s some CSS you might find in a stylesheet:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a:link {\n  color: gray;\n}\n\na:visited {\n  color: green;\n}\n\na:hover {\n  color: rebeccapurple;\n}\n\na:active {\n  color: teal;\n}<\/code><\/pre>\n\n\n\n<p>And here\u2019s minified version of the above CSS example:<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a:link{color:gray}a:visited{color:green}a:hover{color:#663399}a:active{color:teal}\ufeff<\/code><\/pre>\n\n\n\n<p>See how much more compressed the code is?<\/p>\n\n\n\n<p>Minification is performed on a web server before a response is sent. After minification, the web server uses the smaller minified \u2013 and much faster \u2013 files in place of the original ones, resulting in lower bandwidth without sacrificing functionality.<\/p>\n\n\n\n<p><a href=\"https:\/\/yoast.com\/ask-yoast-why-how-minify-js-and-css\/\">As SEO expert Yoast explains<\/a>, minifying files can save up to 30-40%, or even 50% of file size in some cases.<\/p>\n\n\n\n<h2>Why You Should Minify Your HTML, CSS and JavaScript Files<\/h2>\n\n\n\n<p>Having a fast website not only makes Google happy \u2013 and helps your website rank higher in search \u2013 but it provides a better user experience for your site visitors.<\/p>\n\n\n\n<p>There are many stats that make clear why site speed is crucial:&nbsp;<a href=\"https:\/\/blog.kissmetrics.com\/loading-time\/\">40% of people won\u2019t wait 3 seconds for your homepage to load<\/a>&nbsp;and Google recommends&nbsp;<a href=\"https:\/\/www.seroundtable.com\/google-site-speed-recommendation-23057.html\">that sites should load within 2-3 seconds<\/a>.<\/p>\n\n\n\n<p>Minification has many benefits:<\/p>\n\n\n\n<ul><li>Smaller files means the total download size of your site is reduced,<\/li><li>Site visitors will be able to load and access your pages faster,<\/li><li>Site visitors will have an identical user experience without having to download bigger files, and<\/li><li>Site owners will get lower bandwidth costs as less data is transmitted over the network.<\/li><\/ul>\n\n\n\n<h2>How to Minify Your HTML, CSS and JavaScript Files<\/h2>\n\n\n\n<p>Before minifying your site\u2019s files, it\u2019s a good idea to run a backup. Better still, minify your files on a staging site so you can check everything is in working order before making changes to your live site.<\/p>\n\n\n\n<p>It\u2019s also important to benchmark your&nbsp;<a href=\"https:\/\/www.wpkube.com\/improve-speed-wordpress-site\/\">page speed<\/a>&nbsp;before and after minifying your files so you can compare the results and see whether minification has made any impact.<\/p>\n\n\n\n<p>My favorite speed test site is GTmetrix. It analyzes your page speed performance using both Google PageSpeed Insights and YSlow, an open source performance testing tool. It then generates scores and provides recommendations for site optimization improvements.<\/p>\n\n\n\n<p>Other great speed test tools I can recommend include&nbsp;<a href=\"https:\/\/tools.pingdom.com\/\">Pingdom Website Speed Test<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/www.webpagetest.org\/\">WebPageTest<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/testmysite.thinkwithgoogle.com\/\">Test your mobile speed<\/a>.<\/p>\n\n\n\n<h3>Minifying Files Manually<\/h3>\n\n\n\n<p>Minifying files manually takes a considerable amount of time and effort. I mean, who\u2019s got time to remove individual white spaces, lines and unnecessary code from files? Boring! Also, it allows more room for human error. So I wouldn\u2019t recommend this method for minifying files.<\/p>\n\n\n\n<p>Fortunately, there are many free online minification tools available that enable you to copy and paste code from and to your site. Here\u2019s a brief list of tools and I encourage you to research other options that might work better for your site.<\/p>\n\n\n\n<h4>1.&nbsp;<a href=\"https:\/\/www.willpeavy.com\/minifier\/\">Will Peavy\u2019s HTML Minifier<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2072\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/will-peavy-minifier\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier.png\" data-orig-size=\"800,561\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"will-peavy-minifier\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier-300x210.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier.png\" loading=\"lazy\" width=\"800\" height=\"561\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier.png\" alt=\"\" class=\"wp-image-2072\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier-300x210.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier-768x539.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier-720x505.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier-580x407.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/will-peavy-minifier-320x224.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>The HTML Minifier is a free online tool for HTML minification built with PHP. To use the tool, simply paste your HTML into the text area, including any CSS of JavaScript in your markup, and click the \u201cMinify\u201d button. To ensure your scripts work after minification, it\u2019s recommended that you terminate JavaScript statements with a semicolon and use&nbsp;<em>* *<\/em>&nbsp;syntax for comments.<\/p>\n\n\n\n<h4>2.&nbsp;<a href=\"https:\/\/cssminifier.com\/\">CSS Minifier<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2074\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/css-minifier\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier.png\" data-orig-size=\"800,488\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"css-minifier\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-300x183.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier.png\" loading=\"lazy\" width=\"800\" height=\"488\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier.png\" alt=\"\" class=\"wp-image-2074\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-300x183.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-768x468.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-720x439.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-580x354.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-320x195.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>Another free tool, CSS Minifier works by minifying CSS that you copy and paste into the \u201cInput CSS\u201d textarea. There are options for downloading the minified output as a file. For developers, this tool also provides an API.<\/p>\n\n\n\n<h4>3.&nbsp;<a href=\"https:\/\/jscompress.com\/\">JSCompress<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2080\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/js-compress\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress.png\" data-orig-size=\"800,414\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"js-compress\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress-300x155.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress.png\" loading=\"lazy\" width=\"800\" height=\"414\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress.png\" alt=\"\" class=\"wp-image-2080\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress-300x155.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress-768x397.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress-720x373.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress-580x300.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/js-compress-320x166.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>SCompress is an online JavaScript compressor that allows you to compress and minify your JS files by up to 80% of their original size. To use it, copy and paste your code or upload and combine multiple files and then click \u201cCompress JavaScript\u201d. This tool is based on UglifyJS 3 and babili-standalone.<\/p>\n\n\n\n<h3><strong>Manual Minification Tools for Developers<\/strong><\/h3>\n\n\n\n<p>For developers looking for more advanced options, Google recommends these HTML, CSS and JavaScript minification resources:<\/p>\n\n\n\n<ul><li><a href=\"https:\/\/github.com\/kangax\/html-minifier\">HTMLMinifier<\/a>&nbsp;\u2013 A Javascript-based HTML compressor\/minifier (with Node.js support).<\/li><li><a href=\"https:\/\/github.com\/ben-eb\/cssnano\">CSSNano<\/a>&nbsp;\u2013 A modular minifier, built on top of the PostCSS ecosystem.<\/li><li><a href=\"https:\/\/github.com\/css\/csso\">csso<\/a>&nbsp;\u2013 A CSS minifier with structural optimizations.<\/li><li><a href=\"https:\/\/github.com\/mishoo\/UglifyJS2\">UglifyJS<\/a>&nbsp;\u2013 A JavaScript parser, mangler, compressor, and \u201cbeautifier\u201d toolkit.<\/li><\/ul>\n\n\n\n<p>Google\u2019s&nbsp;<a href=\"https:\/\/developers.google.com\/closure\/compiler\">Closure Compiler<\/a>&nbsp;is an optimization tool for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to make better JavaScript. It parses your code, analyzes it, removes dead code and rewrites and minimizes what\u2019s left. This tool also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.<\/p>\n\n\n\n<h3><strong>Minifying Files with Plugins<\/strong><\/h3>\n\n\n\n<p>There are some terrific plugins available, both free and premium, that can minify your files without you having to perform manual steps.<\/p>\n\n\n\n<p><em>Note: For this list, I\u2019ve only included free plugins that are available in the WordPress Plugin Repository that are up-to-date and tested&nbsp;<\/em>compatible with the latest versions of WordPress. For premium options, please scroll down.<\/p>\n\n\n\n<h4>1.&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/html-minify\/\">HTML Minify<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2077\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/html-minify\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify.png\" data-orig-size=\"800,371\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"html-minify\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify-300x139.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify.png\" loading=\"lazy\" width=\"800\" height=\"371\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify.png\" alt=\"\" class=\"wp-image-2077\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify-300x139.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify-768x356.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify-720x334.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify-580x269.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/html-minify-320x148.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>This simple, lightweight and no-hassles plugin enables you to minify the HTML output of your site. To use it, all you need to do is install and activate the plugin and it will automatically minify your markup without the need to configure any settings.<\/p>\n\n\n\n<h4>2.&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/minify-html-markup\/\">Minify HTML<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2082\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/minify-html\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html.png\" data-orig-size=\"800,380\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"minify-html\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html-300x143.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html.png\" loading=\"lazy\" width=\"800\" height=\"380\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html.png\" alt=\"\" class=\"wp-image-2082\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html-300x143.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html-768x365.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html-720x342.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html-580x276.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minify-html-320x152.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>I love the&nbsp;<a href=\"http:\/\/wordpress.org\/\">WordPress.org<\/a>&nbsp;description for this plugin: \u201cEver look at the HTML markup of your website and notice how sloppy and amateurish it looks?\u201d This plugin cleans up and minifies sloppy markup.<\/p>\n\n\n\n<p>Unlike the HTML Minify plugin, this tool provides more options. It includes optional minification for JavaScript and CSS, though it doesn\u2019t mess with text areas or preformatted text. There are also options for removing HTML, CSS and JavaScript comments (leaving MSIE conditional comments), removing unnecessary XHTML closing tags from HTML5 void elements, and removing unnecessary relative schemes and domains from links.<\/p>\n\n\n\n<h4>3.&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/merge-minify-refresh\/\">Merge + Minify + Refresh \u2014 WordPress Plugins<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2081\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/merge-minify-refresh\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh.png\" data-orig-size=\"800,373\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"merge-minify-refresh\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh-300x140.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh.png\" loading=\"lazy\" width=\"800\" height=\"373\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh.png\" alt=\"\" class=\"wp-image-2081\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh-300x140.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh-768x358.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh-720x336.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh-580x270.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/merge-minify-refresh-320x149.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>This plugin does more than just minify your code. It combines your CSS and JavaScript files and&nbsp;<em>then<\/em>&nbsp;minifies the generated files using Minify (for CSS) and Google Closure (for JavaScript). Minification is performed via WP-Cron so that it doesn\u2019t impact your site speed.<\/p>\n\n\n\n<p>When the contents of your CSS or JS files change, they are re-processed so there\u2019s no need to empty your cache. Multisite users will be happy to know this plugin works well on networks.<\/p>\n\n\n\n<h4>4.&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/jch-optimize\/\">JCH Optimize<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2079\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/jch-optimize\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize.png\" data-orig-size=\"800,359\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"jch-optimize\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize-300x135.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize.png\" loading=\"lazy\" width=\"800\" height=\"359\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize.png\" alt=\"\" class=\"wp-image-2079\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize-300x135.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize-768x345.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize-720x323.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize-580x260.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/jch-optimize-320x144.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>JCH Optimize has a bunch of nice features for a free plugin: It combines and minifies CSS and JavaScript, minifies HTML, there\u2019s GZip compression for combines files, sprite generation for background images, and you can exclude certain files from combining to resolve conflicts.<\/p>\n\n\n\n<p>There\u2019s a pro version available with more optimization features, including loading JavaScript asynchronously, optimizing CSS delivery to eliminate render blocking, CDN\/cookie-less domain support, and lazy loading and optimization for images.<\/p>\n\n\n\n<h4>5.&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/css-optimizer\/\">CSS Minify<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2075\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/css-minifier-plugin\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin.png\" data-orig-size=\"800,370\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"css-minifier-plugin\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin-300x139.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin.png\" loading=\"lazy\" width=\"800\" height=\"370\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin.png\" alt=\"\" class=\"wp-image-2075\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin-300x139.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin-768x355.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin-720x333.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin-580x268.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/css-minifier-plugin-320x148.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>Minifying your CSS with this plugin couldn\u2019t be any easier \u2013 just install, activate, go to&nbsp;<em>Settings &gt; CSS Minify<\/em>&nbsp;to enable just one option: Optimize and minify CSS code.<\/p>\n\n\n\n<p>The code in this plugin has been forked from the popular Autoptimize plugin (more on this plugin below). The plugin\u2019s author Peter Pfeiffer has a similar plugin available for JavaScript,&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/optimize-javascript\/\">Minify JavaScript<\/a>.<\/p>\n\n\n\n<h4>6.&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/fast-velocity-minify\/\">Fast Velocity Minify<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2076\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/fast-velocity-minify\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify.png\" data-orig-size=\"800,369\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"fast-velocity-minify\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify-300x138.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify.png\" loading=\"lazy\" width=\"800\" height=\"369\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify.png\" alt=\"\" class=\"wp-image-2076\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify-300x138.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify-768x354.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify-720x332.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify-580x268.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/fast-velocity-minify-320x148.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>With more than 20,000 active installs and a five-star rating, this is one of the more popular options available for minifying files. To use it, install and activate the plugin and go to&nbsp;<em>Settings &gt; Fast Velocity Minify<\/em>. There, you\u2019ll find a stack of options for configuring the plugin, including advanced options for developers JavaScript and CSS exceptions,&nbsp;<a href=\"https:\/\/www.wpkube.com\/best-free-premium-cdns-wordpress\/\">CDN options<\/a>, as well server information. However, the default settings work just fine for most sites.<\/p>\n\n\n\n<p>The plugin performs minification in real-time on the front-end and only during the first uncached request. Once the first request is processed, any other pages that require the same set of CSS and JavaScript will be served that same static cache file.<\/p>\n\n\n\n<h4>7.&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/autoptimize\/\">Autoptimize<\/a><\/h4>\n\n\n\n<p>With more than 400,000 active installs, Autoptimize is easily the most popular minification tool in the WordPress Plugin Repository.<\/p>\n\n\n\n<p>Autoptimize can aggregate, minify and cache scripts and styles, inject CSS into the page header by default and also move and defer scripts to the footer. There are lots of advanced options for developers and an extensive API available so you can you tailor Autoptimize to meet your site\u2019s specific needs.<\/p>\n\n\n\n<h4>8.&nbsp;<a href=\"https:\/\/wordpress.org\/plugins\/hummingbird-performance\/\">Hummingbird Page Speed Optimization<\/a><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img data-attachment-id=\"2078\" data-permalink=\"https:\/\/azoora.com\/blog\/code\/how-to-minify-your-wordpress-sites-css-html-javascript\/attachment\/hummingbird\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird.png\" data-orig-size=\"800,367\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"hummingbird\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird-300x138.png\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird.png\" loading=\"lazy\" width=\"800\" height=\"367\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird.png\" alt=\"\" class=\"wp-image-2078\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird.png 800w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird-300x138.png 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird-768x352.png 768w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird-720x330.png 720w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird-580x266.png 580w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/hummingbird-320x147.png 320w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>Hummingbird is a relatively new plugin to the WordPress Plugin Repository, having started out as a premium plugin. The free version features a great collection of site optimization tools, including minification, enabling you to minify, position and combine files for top performance.<\/p>\n\n\n\n<p>There\u2019s also a great scanning feature that allows you to test your site\u2019s performance and get actionable recommendations for improving your site, right from within the plugin.<\/p>\n\n\n\n<h3><strong>Minification as a Feature in WordPress Caching Plugins<\/strong><\/h3>\n\n\n\n<p>Minification is generally a standard feature you\u2019ll find in&nbsp;<a href=\"https:\/\/www.designbombs.com\/top-wordpress-caching-plugins-compared\/\">caching plugins<\/a>. Here are the plugins I\u2019ve tested and can recommend:<\/p>\n\n\n\n<ul><li><a href=\"https:\/\/wp-rocket.me\/\">WP Rocket<\/a><\/li><li><a href=\"https:\/\/wordpress.org\/plugins\/w3-total-cache\/\">W3 Total Cache<\/a><\/li><li><a href=\"https:\/\/wordpress.org\/plugins\/wp-super-cache\/\">WP Super Cache<\/a><\/li><\/ul>\n\n\n\n<h2>Conclusion<\/h2>\n\n\n\n<p>I hope this article has given you a good knowledge of what minification is for and how you can apply it to your website.<\/p>\n\n\n\n<p>It\u2019s important to keep in mind that minification is more of a fine-tuning step \u2013 you might see a little improvement in your site speed, but it won\u2019t be significant. That said, it\u2019s a best practice worth implementing in addition to other performance and optimization techniques, like combining files.<\/p>\n\n\n\n<p>Also, make sure you configure, test, reconfigure, retest, tweak and check what works best for your website when minifying your files because every website is different.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><em>Have you tried minifying your code? What other methods you have used to make your website faster? Please let us &amp; our subscribers know in the comments section below!<\/em><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Minification is a simple concept that is often recommended as a step towards speeding up your website. But the reality is, it frustrates many site owners no end when they attempt to minify their files and end up breaking their site. So what gives? Minification often requires a lot of experimentation. While there are many [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2084,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[4,77,59],"tags":[25,94,116,73,87,88],"jetpack_featured_media_url":"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/minfication.jpg","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p7FQPL-xp","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/2071"}],"collection":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/comments?post=2071"}],"version-history":[{"count":2,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/2071\/revisions"}],"predecessor-version":[{"id":2192,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/2071\/revisions\/2192"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media\/2084"}],"wp:attachment":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media?parent=2071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/categories?post=2071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/tags?post=2071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}