{"id":4206085,"date":"2022-03-24T10:20:06","date_gmt":"2022-03-24T09:20:06","guid":{"rendered":"https:\/\/wp-rocket.me\/?post_type=core_web_vitals_hub&#038;p=4206085"},"modified":"2024-07-05T10:54:52","modified_gmt":"2024-07-05T08:54:52","slug":"minify-css-javascript","status":"publish","type":"core_web_vitals_hub","link":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/","title":{"rendered":"How to Minify CSS and JavaScript in WordPress"},"content":{"rendered":"<p>Are you looking for a way to minify the CSS and JavaScript of your WordPress site? If you recently ran a performance audit on PageSpeed Insights, you may have noticed the following recommendations: \u201cMinify CSS\u201d and \u201cMinify JavaScript\u201d.<\/p><p>PageSpeed Insights flags all your content if it considers that your CSS and JS files are larger than they need to be.&nbsp;<\/p><p>This article explains what minification of CSS and JavaScript means, why it\u2019s important for performance, and which online tools and plugins you can use to minify your files.<\/p><h2 class=\"wp-block-heading\">What\u2019s Minification?<\/h2><p>Minification literally means&nbsp;<strong>stripping out unneeded parts of CSS and JavaScript files to make them more compact<\/strong>. When developers write code, they will include line breaks, white space, and comments which make the code easier to read but are not needed by your browser to process the code. This optimization technique is done without altering the main function and behavior of the general code while significantly reducing their file size.&nbsp;<\/p><p>The main benefits of minification are reduced bandwidth usage, page size, and loading times.<\/p><p>Which resources can you minify? Both JavaScript and Cascading Style Sheet (CSS) are resources that can go through minification. Let\u2019s go over both optimizations.&nbsp;<\/p><h3 class=\"wp-block-heading\">What\u2019s CSS Minification?<\/h3><p>CSS minification means minimizing CSS from the original size to its smallest size without affecting its primary functionality and breaking the page&#8217;s design.&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"800\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png\" alt=\"Example of minified CSS - Source: WP Rocket\n\" class=\"wp-image-4206106\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket-195x195.png 195w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket-768x768.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket-60x60.png 60w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket-90x90.png 90w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Example of minified CSS &#8211; Source: WP Rocket<br><\/figcaption><\/figure><h3 class=\"wp-block-heading\">What&#8217;s Minification in JavaScript?<\/h3><p>JavaScript minification is the process to make the JS code more compact to ensure that the files are parsed through and delivered as quickly as possible.&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"800\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-JS-Source-WP-Rocket.png\" alt=\"Example of minified JS - Source: WP Rocket\n\" class=\"wp-image-4206112\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-JS-Source-WP-Rocket.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-JS-Source-WP-Rocket-195x195.png 195w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-JS-Source-WP-Rocket-768x768.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Example of minified JS &#8211; Source: WP Rocket<br><\/figcaption><\/figure><p>Note: HTML can also be minified. The resulting HTML page will be a smaller version of the original file, and it will remain a perfectly valid code.<\/p><h3 class=\"wp-block-heading\">What\u2019s the Difference Between Minification vs. Compression?<\/h3><p>The main difference between minification and compression is how the file size is reduced. Compression (GZIP) means replacing the repetitive code with a pointer that uses fewer spaces than the text. For example, after <a href=\"https:\/\/wp-rocket.me\/blog\/gzip-compression-wordpress\/\">GZIP compression<\/a>, you won\u2019t see every single &lt;div or {, in your code file. If GZIP discovers some repetitive text or characters, it won\u2019t display all occurrences.&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"1082\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/File-size-comparison-GZIP-compression-vs-Minification-Source-CSS-tricks.png\" alt=\"File size comparison GZIP compression vs Minification - Source: CSS tricks\n\" class=\"wp-image-4206119\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/File-size-comparison-GZIP-compression-vs-Minification-Source-CSS-tricks.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/File-size-comparison-GZIP-compression-vs-Minification-Source-CSS-tricks-144x195.png 144w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/File-size-comparison-GZIP-compression-vs-Minification-Source-CSS-tricks-768x1039.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">File size comparison GZIP compression vs Minification &#8211; Source: <a href=\"https:\/\/css-tricks.com\/the-difference-between-minification-and-gzipping\/\">CSS tricks<\/a><br><\/figcaption><\/figure><p>Compression is the action to archive files in smaller sizes to make faster requests and reduce the data transfer time. Therefore, compressed code must be uncompressed before execution, while minified code is still a valid code that can be run immediately.&nbsp;<\/p><figure class=\"wp-block-table\"><table><tbody><tr><td>Important note: with minification and compression, the page will have smaller resources &#8211; consisting of less code &#8211; but the visitor will see the same content.<\/td><\/tr><\/tbody><\/table><\/figure><h2 class=\"wp-block-heading\">Why CSS and JS Minification is Important<\/h2><p>CSS and JS minification are important for reducing file size, improving page performance, and passing the related PageSpeed Insights audits. Let\u2019s go over the main benefits of minification.&nbsp;<\/p><h3 class=\"wp-block-heading\">Minification Helps to Boost Performance<\/h3><p>CSS and JS minification improve your WordPress site&#8217;s performance on four different levels:&nbsp;<\/p><ol class=\"wp-block-list\"><li><strong>Improve Loading Time<\/strong><\/li><\/ol><p>JS and CSS minification increase page performance and improve the loading time of your site. For example, when minifying JavaScript, you get a lower JS file payload that reduces the time spent parsing scripts. This results in faster page loads and a well-improved page experience.<\/p><ol class=\"wp-block-list\" start=\"2\"><li><strong>Improve Largest Contentful Paint (LCP)<\/strong> <\/li><\/ol><p><a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-largest-contentful-paint\/\">Largest Contentful Paint<\/a> (LCP) is a <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/\">Core Web Vitals<\/a> metric that measures exactly when the largest element of the page becomes visible for the user. Minification can help to fix the causes of a poor LCP. Both techniques are recommended by Web.dev to improve server response times, reduce JS and CSS blocking time, and improve resource load time.\u00a0The other Core Web Vitals metrics are <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-cumulative-layout-shift\/\">Cumulative Layout Shift<\/a> and <a href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-interaction-to-next-paint\/\">Interaction to Next Paint<\/a>.<\/p><ol class=\"wp-block-list\" start=\"3\"><li><strong>Reduce File Size for a Faster Delivery<\/strong><\/li><\/ol><p>According to <a href=\"https:\/\/css-tricks.com\/the-difference-between-minification-and-gzipping\/\">CSS tricks<\/a>, Gzipping reduces the file size by about five times as minifying does. Minification is recommended to give a little boost to your site and speed up data delivery.&nbsp;<\/p><ol class=\"wp-block-list\" start=\"4\"><li><strong>Reduce CDN billed bandwidth usage<\/strong><\/li><\/ol><p>Minification shortens load time and optimizes the script files, reducing CDN bandwidth consumption for your web pages. A CDN usually charges you by the amount of data transferred from the servers to the customer. As a minified code needs less bandwidth, it will lower the monthly cost of a CDN.&nbsp;<\/p><h3 class=\"wp-block-heading\">Minification Addresses Specific PageSpeed Insights Audits<\/h3><p>When running a performance audit on PageSpeed Insights, you may see some recommendations related to minification.&nbsp;<\/p><p>In our example below, PSI recommends \u201cto minify CSS and JS\u201d to save 2.47 s and 2.4 s. It also flags the URLs that need to be optimized in priority. PageSpeed Insights triggers the rules below because you can reduce the size of your resources through minification:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"151\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/PSI-recommendations-minification.png\" alt=\"Minification\u2019s recommendations - Source: PSI\n\" class=\"wp-image-4206099\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/PSI-recommendations-minification.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/PSI-recommendations-minification-310x59.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/PSI-recommendations-minification-768x145.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Minification\u2019s recommendations &#8211; Source: PSI<br><\/figcaption><\/figure><p>As seen previously, minification also affects the Largest Contentful Paint (LCP) grade.&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"837\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Core-Web-Vitals-LCP-Source-PSI.png\" alt=\"Core Web Vitals (LCP) - Source: PSI\n\" class=\"wp-image-4206126\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Core-Web-Vitals-LCP-Source-PSI.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Core-Web-Vitals-LCP-Source-PSI-186x195.png 186w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Core-Web-Vitals-LCP-Source-PSI-768x804.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Core-Web-Vitals-LCP-Source-PSI-57x60.png 57w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Core-Web-Vitals-LCP-Source-PSI-86x90.png 86w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Core Web Vitals (LCP) &#8211; Source: PSI<br><\/figcaption><\/figure><p>Now that we have explained what minification is essential for performance, let\u2019s go over the techniques to minify CSS and JavaScript on your site.&nbsp;<\/p><h2 class=\"wp-block-heading\">How to Minify CSS and JavaScript in WordPress<\/h2><p>You can minify CSS and JS by using online and development tools or with the help of a WordPress plugin (<em>as recommended by Google<\/em>).<\/p><h3 class=\"wp-block-heading\">How to Minify CSS and JS Without a Plugin<\/h3><p>Let\u2019s go over the main techniques to minify JS and CSS.&nbsp;<\/p><p><strong>Online tools<\/strong><\/p><ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.toptal.com\/developers\/javascript-minifier\/\">Toptal<\/a> (previously known as Javascript minifier) &#8211; a user-friendly tool with an API.&nbsp;<\/li><\/ul><p><\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"402\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-Toptal-.png\" alt=\"Minifying JS - Source: Toptal \n\" class=\"wp-image-4206133\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-Toptal-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-Toptal--310x156.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-Toptal--768x386.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Minifying JS &#8211; Source: Toptal&nbsp;<br><\/figcaption><\/figure><p>And it also works with CSS:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"349\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-Source-Toptal.png\" alt=\"Minifying CSS - Source: Toptal\n\" class=\"wp-image-4206139\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-Source-Toptal.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-Source-Toptal-310x135.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-Source-Toptal-768x335.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-Source-Toptal-138x60.png 138w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-Source-Toptal-206x90.png 206w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Minifying CSS &#8211; Source: <a href=\"https:\/\/www.toptal.com\/developers\/cssminifier\/\">Toptal<\/a><br><\/figcaption><\/figure><ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.cleancss.com\/\">CleanCSS.com<\/a> &#8211; a simple online resource to compress and minify both CSS and JS.<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"592\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-CleanCSS.com_.png\" alt=\"Minifying JS - Source: CleanCSS.com\n\" class=\"wp-image-4206145\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-CleanCSS.com_.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-CleanCSS.com_-264x195.png 264w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-CleanCSS.com_-768x568.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-CleanCSS.com_-81x60.png 81w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-Source-CleanCSS.com_-122x90.png 122w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Minifying JS &#8211; Source: <a href=\"https:\/\/www.cleancss.com\/javascript-minify\/\">CleanCSS.com<\/a><br><\/figcaption><\/figure><p><strong>Development and servers tools&nbsp;<\/strong><\/p><ul class=\"wp-block-list\"><li><a href=\"https:\/\/github.com\/mishoo\/UglifyJS\">UglifyJS<\/a> &#8211; NodeJS has plenty of CLI libraries to minify the code, and UglifyJS is one of them.&nbsp;<\/li>\n\n<li><a href=\"https:\/\/visualstudio.microsoft.com\/\">Visual Studio<\/a>, <a href=\"https:\/\/apps.apple.com\/fr\/app\/xcode\/id497799835?mt=12\">XCode<\/a> (Apple&#8217;s users), <a href=\"https:\/\/netbeans.apache.org\/\">Netbeans<\/a> &#8211; they are all IDEs (integrated development environment) that helps minify JS or CSS manually. Most IDEs and code editors have extensions to allow minification automatically. For example, this is the extension marketplace for Visual Studio:<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"518\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/JS-CSS-Minifier-extension-for-Visual-Studio-Source-Visual-Studios-marketplace.png\" alt=\"JS &amp; CSS  Minifier extension for Visual Studio - Source: Visual Studio\u2019s marketplace\n\" class=\"wp-image-4206151\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/JS-CSS-Minifier-extension-for-Visual-Studio-Source-Visual-Studios-marketplace.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/JS-CSS-Minifier-extension-for-Visual-Studio-Source-Visual-Studios-marketplace-301x195.png 301w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/JS-CSS-Minifier-extension-for-Visual-Studio-Source-Visual-Studios-marketplace-768x497.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">JS &amp; CSS&nbsp; Minifier extension for Visual Studio &#8211; Source: <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=olback.es6-css-minify#:~:text=A%20Minify%20button%20should%20appear,or%20CTRL%2BSHIFT%2BP%20.\">Visual Studio\u2019s marketplace<\/a><br><\/figcaption><\/figure><ul class=\"wp-block-list\"><li>Minifying on the server-side &#8211; some servers Nginx or Apache can be extended to minify with a custom module. Let\u2019s go over two examples.<\/li><\/ul><ol class=\"wp-block-list\"><li>&nbsp;Custom module for Nginx: <a href=\"https:\/\/github.com\/nginx-modules\/nginx-minify\">Nginx Minify <\/a>(from Github)&nbsp;<\/li>\n\n<li>Custom module for Apache: <a href=\"https:\/\/www.unixmen.com\/how-to-auto-minify-javascript-files-on-page-load-in-apache-using-uglifyjs\/\">Apache can also auto minify<\/a> using \u201cmod_ext_filter\u201d with a library.<\/li><\/ol><ul class=\"wp-block-list\"><li>Content Delivery Networks (CDNs) &#8211; Many of them support minifying assets on edge. A popular example is Cloudflare, and its \u201cauto minify option\u201d:<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"362\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Auto-minify-settings-Source-Cloudflare.png\" alt=\"Auto minify settings - Source: Cloudflare\n\" class=\"wp-image-4206159\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Auto-minify-settings-Source-Cloudflare.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Auto-minify-settings-Source-Cloudflare-310x140.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Auto-minify-settings-Source-Cloudflare-768x348.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Auto-minify-settings-Source-Cloudflare-133x60.png 133w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Auto-minify-settings-Source-Cloudflare-199x90.png 199w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Auto minify settings &#8211; Source: <a href=\"https:\/\/support.cloudflare.com\/hc\/en-us\/articles\/200168196-How-do-I-minify-HTML-CSS-and-JavaScript-to-optimize-my-site-\">Cloudflare<\/a><br><\/figcaption><\/figure><figure class=\"wp-block-table\"><table><tbody><tr><td>Want to learn more? Check our guide about <a href=\"https:\/\/wp-rocket.me\/blog\/best-free-css-and-javascript-minification-tools\/#section-3\">the best CSS and JS minifying tools<\/a>.<\/td><\/tr><\/tbody><\/table><\/figure><p><strong>\u26a0\ufe0f <\/strong>If you are not comfortable manipulating JavaScript and CSS files and re-uploading them to your server, you may prefer using a WordPress plugin to do the job for you.&nbsp;<\/p><div id=\"om-nyrydv5iync8zrrulm5i-holder\"><\/div>\n\t<script>(function (d, u, ac) {\n\t\t\tvar s = d.createElement('script')\n\t\t\ts.type = 'text\/javascript'\n\t\t\ts.src = 'https:\/\/a.omappapi.com\/app\/js\/api.min.js'\n\t\t\ts.async = true\n\t\t\ts.dataset.user = u\n\t\t\ts.dataset.campaign = ac\n\t\t\td.getElementsByTagName('head')[0].appendChild(s)\n\t\t})(document, 20440, 'nyrydv5iync8zrrulm5i')<\/script><h3 class=\"wp-block-heading\">How to Minify CSS and JS With a WordPress Plugin<\/h3><p>PageSpeed recommends using a WordPress plugin to minify CSS or Javascript.&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/PSI-recommending-WordPress-plugins-Source-PSI-Diagnostic-section-.png\" alt=\"PSI recommending WordPress plugins - Source: PSI Diagnostic section \n\" class=\"wp-image-4206166\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/PSI-recommending-WordPress-plugins-Source-PSI-Diagnostic-section-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/PSI-recommending-WordPress-plugins-Source-PSI-Diagnostic-section--310x116.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/PSI-recommending-WordPress-plugins-Source-PSI-Diagnostic-section--768x288.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">PSI recommending WordPress plugins &#8211; Source: PSI Diagnostic section&nbsp;<br><\/figcaption><\/figure><p>Amongst the best minify plugins, you\u2019ll find:&nbsp;<\/p><ul class=\"wp-block-list\"><li><a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a> &#8211; the complete performance suite that minifies multiple files of CSS and JS and applies GZIP compression. WP Rocket is also one of the <a href=\"https:\/\/wp-rocket.me\/best-wordpress-caching-plugin\/\">best caching plugins for WordPress<\/a>.<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"211\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-in-one-click-Source-WP-Rocket.png\" alt=\"Minifying CSS in one click - Source: WP Rocket\n\" class=\"wp-image-4206173\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-in-one-click-Source-WP-Rocket.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-in-one-click-Source-WP-Rocket-310x82.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-in-one-click-Source-WP-Rocket-768x203.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-in-one-click-Source-WP-Rocket-190x50.png 190w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-CSS-in-one-click-Source-WP-Rocket-341x90.png 341w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Minifying CSS in one click &#8211; Source: <a href=\"https:\/\/wp-rocket.me\/\">WP Rocket<\/a><br><\/figcaption><\/figure><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"130\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-in-one-click-Source-WP-Rocket.png\" alt=\"Minifying JS in one click - Source: WP Rocket\n\" class=\"wp-image-4206179\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-in-one-click-Source-WP-Rocket.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-in-one-click-Source-WP-Rocket-310x50.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Minifying-JS-in-one-click-Source-WP-Rocket-768x125.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Minifying JS in one click &#8211; Source: <a href=\"https:\/\/wp-rocket.me\/\">WP Rocket<\/a><br><\/figcaption><\/figure><ul class=\"wp-block-list\"><li><strong>Autoptimize<\/strong> &#8211; it can aggregate, minify and compress scripts and styles.<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"384\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Free-download-of-Autoptimize-Source-WordPress-repository.png\" alt=\"Free download of Autoptimize - Source: WordPress repository\n\" class=\"wp-image-4206185\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Free-download-of-Autoptimize-Source-WordPress-repository.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Free-download-of-Autoptimize-Source-WordPress-repository-310x149.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Free-download-of-Autoptimize-Source-WordPress-repository-768x369.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Free download of Autoptimize &#8211; Source: <a href=\"https:\/\/wordpress.org\/plugins\/autoptimize\/\">WordPress repository<\/a><br><\/figcaption><\/figure><ul class=\"wp-block-list\"><li><strong>Asset Clean-up<\/strong> &#8211; It minifies CSS and JS files, including inline code within style and script tags.&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"383\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Free-download-of-Asset-Clean-Up-Source-WordPress-repository.png\" alt=\"Free download of Asset Clean Up - Source: WordPress repository\n\" class=\"wp-image-4206191\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Free-download-of-Asset-Clean-Up-Source-WordPress-repository.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Free-download-of-Asset-Clean-Up-Source-WordPress-repository-310x148.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Free-download-of-Asset-Clean-Up-Source-WordPress-repository-768x368.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Free download of Asset Clean Up &#8211; Source: <a href=\"https:\/\/wordpress.org\/plugins\/wp-asset-clean-up\/\">WordPress repository<\/a><br><\/figcaption><\/figure><p>Once the minification is done, we recommend doing the two following verifications:<\/p><ul class=\"wp-block-list\"><li>Check that the page is not broken on the front-end (the process can occasionally break how scripts works or style renders).<\/li>\n\n<li>Verify that the minification is properly working.&nbsp;<\/li><\/ul><p><strong>How to check if minification is working?&nbsp;<\/strong><\/p><ol class=\"wp-block-list\"><li>Run your URL through Google PageSpeed Insights and scroll to the \u201cdiagnostic\u201d area. If Lighthouse does not flag any issues, your site is minifying the code.&nbsp;<\/li>\n\n<li>Go to <a href=\"https:\/\/seositecheckup.com\/\">SEO Site Checkup<\/a> and run a quick audit of your site. If the CSS is minified, you\u2019ll pass just like in our example below:&nbsp;<\/li><\/ol><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"507\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Checking-if-the-code-is-minified-source-SEO-Site-Checkup.png\" alt=\"Checking if the code is minified - source: SEO Site Checkup\n\" class=\"wp-image-4206198\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Checking-if-the-code-is-minified-source-SEO-Site-Checkup.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Checking-if-the-code-is-minified-source-SEO-Site-Checkup-308x195.png 308w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Checking-if-the-code-is-minified-source-SEO-Site-Checkup-768x487.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Checking-if-the-code-is-minified-source-SEO-Site-Checkup-95x60.png 95w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Checking-if-the-code-is-minified-source-SEO-Site-Checkup-142x90.png 142w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Checking if the code is minified &#8211; source: <a href=\"https:\/\/seositecheckup.com\/\">SEO Site Checkup<\/a><br><\/figcaption><\/figure><h2 class=\"wp-block-heading\">What\u2019s the Real Impact on Speed with Minification?<\/h2><p>We\u2019ve seen how minification can help improve the performance of a WordPress site <em>(even Google recommends doing such optimizations).&nbsp;<\/em><\/p><p>To understand the importance of minification on performance, let\u2019s run an audit on PageSpeed Insights. There will be three steps:&nbsp;<\/p><ul class=\"wp-block-list\"><li><a href=\"#step-1\">Step #1 &#8211; PSI audit without any optimizations<\/a><\/li>\n\n<li><a href=\"#step-2\">Step #2 &#8211; Minification and GZIP compression by WP Rocket<\/a><\/li>\n\n<li><a href=\"#step-3\">Step #3 &#8211; Minification, compression, plus other advanced optimizations techniques by WP Rocket<\/a>.&nbsp;&nbsp;<\/li><\/ul><h3 class=\"wp-block-heading\" id=\"step-1\">Step #1 &#8211; PageSpeed Insights audit without any optimizations<\/h3><p>The recommendations I get from Lighthouse are related to optimizing my CSS and JS, including its minification:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"982\" height=\"349\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Caching-and-code-optimization-recommendations.png\" alt=\"Caching and code optimization recommendations - Source: PSI\n\" class=\"wp-image-4206209\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Caching-and-code-optimization-recommendations.png 982w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Caching-and-code-optimization-recommendations-310x110.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Caching-and-code-optimization-recommendations-768x273.png 768w\" sizes=\"(max-width: 982px) 100vw, 982px\" \/><figcaption class=\"wp-element-caption\">Caching and code optimization recommendations &#8211; Source: PSI<br><\/figcaption><\/figure><p>I\u2019m also seeing some render-blocking issues with an estimated savings of 1.43 s. Why is that related to minification? PSI <a href=\"https:\/\/web.dev\/render-blocking-resources\/\">recommends minifying CSS to eliminate render-blocking resources<\/a>. Minification is an important performance technique to address such recommendations; however, there\u2019s something else you should do to tackle it fully. We will go over it in <a href=\"#step-3\">step #3<\/a>.&nbsp;<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"384\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-are-the-render-blocking-resources-Source-PSI.png\" alt=\"CSS and JS are the render-blocking resources - Source: PSI\n\" class=\"wp-image-4206216\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-are-the-render-blocking-resources-Source-PSI.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-are-the-render-blocking-resources-Source-PSI-310x149.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-are-the-render-blocking-resources-Source-PSI-768x369.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-are-the-render-blocking-resources-Source-PSI-125x60.png 125w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-are-the-render-blocking-resources-Source-PSI-188x90.png 188w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">CSS and JS are the render-blocking resources &#8211; Source: PSI<br><\/figcaption><\/figure><p>The overall performance is not so great either, with a 69\/100 grade:<\/p><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"518\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Overall-performance-no-optimization-.png\" alt=\"Overall performance - no optimization\n\" class=\"wp-image-4206222\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Overall-performance-no-optimization-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Overall-performance-no-optimization--301x195.png 301w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Overall-performance-no-optimization--768x497.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Overall performance &#8211; no optimization<br><\/figcaption><\/figure><h3 class=\"wp-block-heading\" id=\"step-2\">Step #2 &#8211; Minification and GZIP compression by WP Rocket\ud83d\ude80<\/h3><p>After activating WP Rocket, I could see some instant improvements in the performance and the PSI audit, namely:<\/p><ul class=\"wp-block-list\"><li>The \u201cMinify CSS\u201d and&nbsp;\u201cMinify JS\u201d issues have been solved and moved to the \u201cpassed audit\u201d section.&nbsp;<\/li>\n\n<li>My warnings about caching and compression are also fixed because WP Rocket automatically enables page and browser caching, and GZIP compression:<\/li><\/ul><figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Performance without WP Rocket<\/strong><\/td><td><strong> <strong>Minification and GZIP compression by WP Rocket <\/strong> \ud83d\ude80<\/strong><\/td><\/tr><tr><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/3NXKXv8pBkRvSreeDS-6A21hQDTNXVunFZu5nmb_a9bAx-xGbGOCtOWGI3Y0y87mX9waot7bOMVQFIg1ncGrpv7-o4zeiVFkmSc46zJQYIsI6ZojSHfOrcghdhSaaJxZU9uKg8xG\" width=\"286\" height=\"101\"><\/td><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/63GGGSspdIS6rf4oyeJXJw-oQmbY6qVrvWvOqHZtGubKZUCNl4JS0cLl7PmQv7TA-mr61Bn3Vy2CMyJj218P5JWlsCUYdMnsvCJcKiGW11j76BPwIsP6C96GCrTgCgaYRLD5mj79\" width=\"286\" height=\"67\"><\/td><\/tr><\/tbody><\/table><\/figure><ul class=\"wp-block-list\"><li>Thanks to minification, my overall performance went from 69\/100 to 82\/100, which is a neat improvement.&nbsp;<\/li>\n\n<li>My LCP is now in orange (2.1 s with minification) against 5.4 s before.&nbsp;<\/li><\/ul><figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Performance without WP Rocket<\/strong><\/td><td><strong>Minification and GZIP compression by WP Rocket <\/strong><strong>\ud83d\ude80<\/strong><\/td><\/tr><tr><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/Bh_x7_uuovNOqzcg4ougARltar4NVyoYOCiZdD4g6XnFSIVkCtcrTBQOGluKWJEsgAy8Rftxyz_TNrlUZ16g9yOT-ilEy2wUx1yuVPKkMDgB_8PFCKfWk5iICw7eOHgRxBo-82Le\" width=\"286\" height=\"185\"><\/td><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/Dk2oopGD7ylGePfasEHU6V2zhSEGd81JEl_3C5H3Jra1GUXcN6cxj6hBiQ8co-U1kLrwbyIu_kxsoaNjkVcB8uvsaR6z-psgNXC52PtaHNE0nnOmyEC-raE3acnsrCOlcKXCjfsI\" width=\"278\" height=\"180\"><\/td><\/tr><\/tbody><\/table><\/figure><h3 class=\"wp-block-heading\" id=\"step-3\"><br>Step #3 &#8211; Minification, compression, and other advanced optimizations techniques by WP Rocket \ud83d\ude80<\/h3><p>Thanks to additional WP Rocket optimizations, I also managed to fix the &#8220;Eliminate render-blocking&#8221; audit issue.&nbsp;<\/p><figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Performance without WP Rocket<\/strong><\/td><td><strong>Full performance optimization by WP Rocket <\/strong><strong>\ud83d\ude80<\/strong><\/td><\/tr><tr><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/3NXKXv8pBkRvSreeDS-6A21hQDTNXVunFZu5nmb_a9bAx-xGbGOCtOWGI3Y0y87mX9waot7bOMVQFIg1ncGrpv7-o4zeiVFkmSc46zJQYIsI6ZojSHfOrcghdhSaaJxZU9uKg8xG\" width=\"286\" height=\"101\"><\/td><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/DLj6qTrSEmlPtBiCGyvr45aBFGu7UcbQKmMx33MAtXklhhxRg1r52f0B7tMjsoEnt0k4HU90mwJUjobRI2P5nFjBp0U5unUStARe_OulB2mJno0Fo1EIjsY6Oiw5NspHgPxk5hAh\" width=\"286\" height=\"137\"><\/td><\/tr><\/tbody><\/table><\/figure><p>By minifying JS and CSS along with other code compressions and optimizations, WP Rocket also improved my overall performance grade and put my Core Web Vitals in the green:<\/p><figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Performance without WP Rocket<\/strong><\/td><td><strong><strong>Minification and GZIP compression by WP Rocket <\/strong> <\/strong><\/td><td><strong>Full performance optimization by WP Rocket <\/strong><strong>\ud83d\ude80<\/strong><\/td><\/tr><tr><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/Bh_x7_uuovNOqzcg4ougARltar4NVyoYOCiZdD4g6XnFSIVkCtcrTBQOGluKWJEsgAy8Rftxyz_TNrlUZ16g9yOT-ilEy2wUx1yuVPKkMDgB_8PFCKfWk5iICw7eOHgRxBo-82Le\" width=\"179\" height=\"116\"><\/td><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/Dk2oopGD7ylGePfasEHU6V2zhSEGd81JEl_3C5H3Jra1GUXcN6cxj6hBiQ8co-U1kLrwbyIu_kxsoaNjkVcB8uvsaR6z-psgNXC52PtaHNE0nnOmyEC-raE3acnsrCOlcKXCjfsI\" width=\"186\" height=\"120\"><\/td><td><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/8OMgDkwYoiseJ0_oilW99WPxWTY5grUZF-wPhmuRYNbe2JdFpMLmQM2NqTPny0saEopVmBzfDFVSWqdbq3pc1dNWKBsEqdeymYfcnbMvFeS__CIQMcTsGr3YhLWVl28vgdr_9-XU\" width=\"202\" height=\"138\"><\/td><\/tr><\/tbody><\/table><\/figure><p>If you want to minify your code and <a href=\"https:\/\/wp-rocket.me\/blog\/guide-to-page-speed-optimization-for-wordpress\/\">speed up your WordPress site<\/a>, here are the WP Rocket features you should use:&nbsp;<\/p><ul class=\"wp-block-list\"><li>Minify JS and CSS:&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"382\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-files-minified-Source-WP-Rocket-.png\" alt=\"CSS and JS files minified - Source: WP Rocket \n\" class=\"wp-image-4206232\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-files-minified-Source-WP-Rocket-.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-files-minified-Source-WP-Rocket--310x148.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-files-minified-Source-WP-Rocket--768x367.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-files-minified-Source-WP-Rocket--126x60.png 126w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/CSS-and-JS-files-minified-Source-WP-Rocket--188x90.png 188w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">CSS and JS files minified &#8211; Source: <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket&nbsp;<\/a><br><\/figcaption><\/figure><figure class=\"wp-block-table\"><table><tbody><tr><td>\ud83d\udca1 Why are you not seeing an option for HTML minification? <a href=\"https:\/\/github.com\/wp-media\/wp-rocket\/issues\/2682\">WP Rocket decided to stop the \u201cminifying HTML\u201d<\/a> option. According to GTMetrix, the impact on performance was not so important.<\/td><\/tr><\/tbody><\/table><\/figure><ul class=\"wp-block-list\"><li>GZIP compression: WP Rocket automatically enables HTML, CSS, and JS compression to render the files sent to the browser faster.<\/li><\/ul><p>In addition to the minification features, in the 3rd step I enabled the following features and achieved the 97\/100 PageSpeed Insights score:<\/p><ul class=\"wp-block-list\"><li>Optimize CSS delivery &#8211; Remove unused CSS option:<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"400\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Optimize-CSS-delivery-Source-WP-Rocket.png\" alt=\"Optimize CSS delivery - Source: WP Rocket \" class=\"wp-image-4206238\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Optimize-CSS-delivery-Source-WP-Rocket.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Optimize-CSS-delivery-Source-WP-Rocket-310x155.png 310w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Optimize-CSS-delivery-Source-WP-Rocket-768x384.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Optimize-CSS-delivery-Source-WP-Rocket-120x60.png 120w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Optimize-CSS-delivery-Source-WP-Rocket-180x90.png 180w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Optimize CSS delivery &#8211; Source: <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket<\/a><\/figcaption><\/figure><ul class=\"wp-block-list\"><li>Load JavaScript deferred and delay JS execution:&nbsp;<\/li><\/ul><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"749\" src=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Load-JS-deferred-and-delay-JS-execution-Source-WP-Rocket.png\" alt=\"Load JS deferred and delay JS execution Source: WP Rocket \n\" class=\"wp-image-4206247\" srcset=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Load-JS-deferred-and-delay-JS-execution-Source-WP-Rocket.png 800w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Load-JS-deferred-and-delay-JS-execution-Source-WP-Rocket-208x195.png 208w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Load-JS-deferred-and-delay-JS-execution-Source-WP-Rocket-768x719.png 768w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Load-JS-deferred-and-delay-JS-execution-Source-WP-Rocket-64x60.png 64w, https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Load-JS-deferred-and-delay-JS-execution-Source-WP-Rocket-96x90.png 96w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Load JS deferred and delay JS execution Source: <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket&nbsp;<\/a><br><\/figcaption><\/figure><figure class=\"wp-block-table\"><table><tbody><tr><td>\u26a0\ufe0f Minification might break scripts and styles on some edge cases. To avoid this, WP Rocket has an extensive compatibility library for automatic exclusions whenever they find any.<\/td><\/tr><\/tbody><\/table><\/figure><h2 class=\"wp-block-heading\">Wrapping Up&nbsp;<\/h2><p>We are building more and more advanced sites today that require more features, more code (and sometimes more plugins). What is critically important about minifying CSS and JavaScript is that they are both render-blocking resources \u2013&nbsp; without optimization, they will impact performance.&nbsp;<\/p><p>Minifying your code is one of the best ways to reduce the size of JS and CSS file size. Smaller files improve download speeds, which can significantly depend on your website\u2019s size.&nbsp;<\/p><p>One of the easiest ways to minify CSS or JS is to use <a href=\"https:\/\/wp-rocket.me\/features\/\">WP Rocket.<\/a> The plugin can also optimize the CSS delivery, defer JS and delay JS execution. No risks are taken: you have a 14-day money-back guarantee if you see no speed improvements.<\/p>","protected":false},"excerpt":{"rendered":"<p>Looking for the fastest and easiest way to minify CSS and JavaScript on WordPress and give a boost to your site speed? Keep reading and you&#8217;ll find all the information you need.<\/p>\n","protected":false},"template":"","core_web_vitals":[132],"class_list":["post-4206085","core_web_vitals_hub","type-core_web_vitals_hub","status-publish","hentry","core_web_vitals-improve-largest-contentful-paint"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Minify CSS and JavaScript in WordPress<\/title>\n<meta name=\"description\" content=\"Looking for the fastest and easiest way to minify CSS and JavaScript files on WordPress and give a boost to your site speed? Keep reading and you&#039;ll find all the information you need.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Minify CSS and JavaScript in WordPress\" \/>\n<meta property=\"og:description\" content=\"Looking for the fastest and easiest way to minify CSS and JavaScript files on WordPress and give a boost to your site speed? Keep reading and you&#039;ll find all the information you need.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Rocket\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-05T08:54:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wp_rocket\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"16 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/\",\"url\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/\",\"name\":\"How to Minify CSS and JavaScript in WordPress\",\"isPartOf\":{\"@id\":\"https:\/\/wp-rocket.me\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png\",\"datePublished\":\"2022-03-24T09:20:06+00:00\",\"dateModified\":\"2024-07-05T08:54:52+00:00\",\"description\":\"Looking for the fastest and easiest way to minify CSS and JavaScript files on WordPress and give a boost to your site speed? Keep reading and you'll find all the information you need.\",\"breadcrumb\":{\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#primaryimage\",\"url\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png\",\"contentUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png\",\"width\":800,\"height\":800},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wp-rocket.me\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Core Web Vitals\",\"item\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Largest Contentful Paint\",\"item\":\"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-largest-contentful-paint\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to Minify CSS and JavaScript in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wp-rocket.me\/#website\",\"url\":\"https:\/\/wp-rocket.me\/\",\"name\":\"WP Rocket\",\"description\":\"Plugin d&#039;optimisation de sites WordPress\",\"publisher\":{\"@id\":\"https:\/\/wp-rocket.me\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wp-rocket.me\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/wp-rocket.me\/#organization\",\"name\":\"WP Rocket\",\"url\":\"https:\/\/wp-rocket.me\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wp-rocket.me\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/logo-wp-rocket-paypal-2.png\",\"contentUrl\":\"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/logo-wp-rocket-paypal-2.png\",\"width\":150,\"height\":41,\"caption\":\"WP Rocket\"},\"image\":{\"@id\":\"https:\/\/wp-rocket.me\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829\",\"https:\/\/x.com\/wp_rocket\",\"https:\/\/www.youtube.com\/channel\/UC1ozThXHd1IWIZ5wkshgp_Q\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Minify CSS and JavaScript in WordPress","description":"Looking for the fastest and easiest way to minify CSS and JavaScript files on WordPress and give a boost to your site speed? Keep reading and you'll find all the information you need.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Minify CSS and JavaScript in WordPress","og_description":"Looking for the fastest and easiest way to minify CSS and JavaScript files on WordPress and give a boost to your site speed? Keep reading and you'll find all the information you need.","og_url":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/","og_site_name":"WP Rocket","article_publisher":"https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829","article_modified_time":"2024-07-05T08:54:52+00:00","og_image":[{"url":"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png"}],"twitter_card":"summary_large_image","twitter_site":"@wp_rocket","twitter_misc":{"Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/","url":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/","name":"How to Minify CSS and JavaScript in WordPress","isPartOf":{"@id":"https:\/\/wp-rocket.me\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#primaryimage"},"image":{"@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png","datePublished":"2022-03-24T09:20:06+00:00","dateModified":"2024-07-05T08:54:52+00:00","description":"Looking for the fastest and easiest way to minify CSS and JavaScript files on WordPress and give a boost to your site speed? Keep reading and you'll find all the information you need.","breadcrumb":{"@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#primaryimage","url":"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png","contentUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/2022\/03\/Example-of-minified-CSS-Source-WP-Rocket.png","width":800,"height":800},{"@type":"BreadcrumbList","@id":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/minify-css-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wp-rocket.me"},{"@type":"ListItem","position":2,"name":"Core Web Vitals","item":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/"},{"@type":"ListItem","position":3,"name":"Largest Contentful Paint","item":"https:\/\/wp-rocket.me\/google-core-web-vitals-wordpress\/improve-largest-contentful-paint\/"},{"@type":"ListItem","position":4,"name":"How to Minify CSS and JavaScript in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/wp-rocket.me\/#website","url":"https:\/\/wp-rocket.me\/","name":"WP Rocket","description":"Plugin d&#039;optimisation de sites WordPress","publisher":{"@id":"https:\/\/wp-rocket.me\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wp-rocket.me\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/wp-rocket.me\/#organization","name":"WP Rocket","url":"https:\/\/wp-rocket.me\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wp-rocket.me\/#\/schema\/logo\/image\/","url":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/logo-wp-rocket-paypal-2.png","contentUrl":"https:\/\/wp-rocket.me\/wp-content\/uploads\/1\/logo-wp-rocket-paypal-2.png","width":150,"height":41,"caption":"WP Rocket"},"image":{"@id":"https:\/\/wp-rocket.me\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pages\/WP-Rocket\/631942253526829","https:\/\/x.com\/wp_rocket","https:\/\/www.youtube.com\/channel\/UC1ozThXHd1IWIZ5wkshgp_Q"]}]}},"_links":{"self":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/core_web_vitals_hub\/4206085"}],"collection":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/core_web_vitals_hub"}],"about":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/types\/core_web_vitals_hub"}],"wp:attachment":[{"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/media?parent=4206085"}],"wp:term":[{"taxonomy":"core_web_vitals","embeddable":true,"href":"https:\/\/wp-rocket.me\/wp-json\/wp\/v2\/core_web_vitals?post=4206085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}