Remove unused CSS
-
Hi, I need to reduce unused CSS.
How do i configure W3 total cache to achieve this?
The page I need help with: [log in to see the link]
-
Hello @alexlever17
Thank you for reaching out and I am happy to assist you with this.
In short, you cant, and no plugin can do this properly and succesfuly.
Lighthouse and Google PageSpeed Insights may advise you to Reduce Unused JavaScript or to Reduce Unused CSS. This can be one of the most difficult recommendations to follow, for a few reasons.
First, the recommendation engine itself is pretty simple. Take this example of pseudo-code:
if ( is_page('home') ) {
/* A chunk of code that only displays on the homepage / } else { / A chunk of code that displays on all other pages */
}
In this example, if you were to run PageSpeed Insights on your home page, everything in the code block that displays on all your other pages counts as “unused.” Because of this, you should keep in mind that the “unused” measurements aren’t always completely accurate measurements. Similarly, if your CSS includes rules for elements that only appear on certain pages, that will also show up as “unused” even though you may be using those CSS rules on other pages of your website.The most effective way to remove unused JavaScript and CSS is to remove any extraneous plugins that you may have on your website. In addition, make sure that the plugins you do choose to use only enqueue their assets on pages that use those plugins.
However, W3 Total Cache also offers another tool for your to mitigate unused assets.

Using Manual Minify, you have the ability to only include JavaScript and CSS Assets on certain theme templates. You can utilize this feature to create templates within your theme that need additional assets. For example, if you have a Contact Form, you can create a unique contact form template and include your form plugin’s assets only on that template.
So this can help, however, cannot completely remove unused CSS/JS, especially the ones that are loading on your website from another server, like some JS files in your case, Vimeo, HOojar, Facebook, etc.
Eliminating render blocking resources can also help with this, however, this only works with minified files where you can feffer the jS files and Eliminate render blocking CSS by moving it to http body, which is a Pro feature in W3 Total Cache.
I hope this helps!
Thanks for explaining.
I’d like to eliminate render blocking resoucres as that’ll make a bigger difference.
Is there a trial period where I can test the pro verison with my website to see how much of a difference it makes?
Or a refund policy.
Hello @alexlever17
Please reach out to us directly via the plugin in Performance>Support>Sales. We cannot discuss this here as it’s against the wp.org guidelines.
Thanks!
Yep, I submited an enquiry on the website yesterday. I’ve also just submitted another one via that method you stated.
Thanks.
Hey @alexlever17
Just to let you know that we’ve received your email and replied with the requested information.
Thanks!
The topic ‘Remove unused CSS’ is closed to new replies.