Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cleaning up CSS files

Tags:

css

stylesheet

I have a bunch of CSS files with a bunch of classes. I know a lot are not used.

Is there a tool that will scan your site and clean up your CSS files or tell me which ones aren't used?

like image 238
Boone Avatar asked Jul 11 '10 19:07

Boone


People also ask

How do I delete unused CSS files?

If you want to remove unused CSS entirely, you can use a tool such as PurifyCSS to find out how much CSS file size can be reduced. Once you get the CSS code you should eliminate, you have to remove it manually from the page. If you want to deep dive into a manual solution, you can read the CSS-tricks in-depth article.

Can I delete .CSS files?

You can't delete CSS files through Javascript on the browser because that's a client-side scripting language.

What does clean CSS mean?

The clear CSS property sets whether an element must be moved below (cleared) floating elements that precede it. The clear property applies to floating and non-floating elements.


2 Answers

Have a look at excellent firefox addon:

Dust-Me Selectors

alt text
(source: mozilla.org)

like image 124
Sarfraz Avatar answered Sep 20 '22 20:09

Sarfraz


This site has some nice tricks about what you need to do http://www.makeuseof.com/tag/useful-tools-to-check-clean-and-optimize-your-css-file/.

It suggests some tools like a Firefox plugin called Dust-Me selectors.. http://www.sitepoint.com/dustmeselectors/

alt text
(source: netdna-cdn.com)

like image 28
Jack Avatar answered Sep 17 '22 20:09

Jack