CSSCSS and the crazy styles

Have you faced this scenario in your web project?

A HUGE CSS file and a team that contributes to make it bigger everyday?

Even though it looks like you guys talk a lot about it and establish your guidelines you “find” sometimes that your buddy programmer is creating the same CSS classes for the same button used in Feature A or B?

How about thinking that you have enough experience with ruby on rails that you definitely can’t learn anymore? (But you still create bugs or poor code in the project)

Well I think I finally started realizing this and thought it will be awesome to do something, except that I didn’t know what. Lucky for me I met @zmoazeni from http://getharvest.com in the last RubyMidWest . He gave his elevator speech for the gem CSSCSS and boom! This tool helps you to check your CSS across different files or single file and validates where are duplicated class everywhere in your code base.

Yes but what exactly do that means?

First, install the gem

$ gem install csscss

Second, run the command (remember to check gem documentation here):

$ csscss /path/to/your/crazy/css.css


Third, want to see what are those dupes:

$ csscss -v /path/to/your/crazy/css.css

csscss -v

Ok, but how does this help me?  Ideally you need to this into your daily practices so you can avoid having a bunch of copy/paste classes everywhere in the code instead of reusing them.

Yeah but what else it does for me? You can shrink and structure your CSS more efficiently and the best is that you create re-usable CSS classes instead of many maaaany maaaany sub classes duplicated.

Please let me know your thoughts.