Cyril Gupta
Cyril Gupta

Reputation: 13723

How can I remove unused CSS classes from my website project?

My project has collected CSS entropy (unused classes) during its course of development.

Now in order to keep the CSS file small, I want to remove all unused CSS references. But doing that manually involves searching for each class in the entire project. That takes time.

Do you know of any way/tool which I can adopt to find out which CSS classes are no longer used in my project, and remove it?

I am programming on ASP.NET. Visual Studio.

Upvotes: 16

Views: 19068

Answers (3)

Ankit
Ankit

Reputation: 4925

In the Chrome Browser, press F12, go to the Audit tab, choose the "Reload page and audit on Load" option, and refresh the page. Chrome will list all the unused CSS rules.

For an online solution, go to unused-css.com.

Upvotes: 13

Ian Oxley
Ian Oxley

Reputation: 11056

You might find this Firefox extension useful: http://www.sitepoint.com/dustmeselectors/

Upvotes: 11

devio
devio

Reputation: 37225

I wrote a tool which allows you to find all class and CssClass attributes in your aspx source code.

See my blog entry for info and download.

Upvotes: 5

Related Questions