HI.. My project has many CSS roles and JavaScript scripts that are not used in my project. How can I find these unused files?
The Coverage tab in Chrome DevTools can help you find unused JavaScript and CSS code. Removing unused code can speed up your page load and save your mobile users cellular data.
1. Audit Tab: > Right Click + Inspect Element on the page, find the "Audit" tab, and run the audit, making sure "Web Page Performance" is checked. Lists all unused CSS tags - see image below.
On the post edit screen, you'll find the Asset CleanUp box just below the post editor. The plugin will automatically fetch and list all the files and assets loaded when a visitor views this page on your website. You can then simply unload the unused CSS or JavaScript files that you don't need on that page.
There is a nice little firefox plugin called Dust Me Selectors, which scans a page for CSS which isn't being used.
It's a very good tool for spotting things in your stylesheets which are redundant.
However, you still need to be careful with it, as it is quite possible for a stylesheet to be unused when you run the program, but still necessary for your site - ie it could be used for dynamic content, or for other pages which share the same stylesheet code, etc.
[EDIT]
I've removed my previous edit where I noted that this project might have been abandoned, because in fact it looks like it's back in active development. Good news all round.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With