0

I'm working on a website. It is quite large, it has over 100 style sheets, and Im (again) starting to lose styles in IE. I've configured rails to compile all of my CSS into one file, and Im only losing styles in IE. IE can only compile 4095 style rules.

Is there a fast and easy way of determining how many style rules a site has? I've looked in various places and I see no such option.

Also, is there a good tool for ruby/rails that minimizes your styles?

Thanks
-Brian

OneChillDude
  • 7,250
  • 9
  • 36
  • 76
  • 1
    For an oversimplified count, you could look at the number of `{`s in your combined style sheet right? Overall you might starting looking into OOCSS, probably can get a pretty big bang for the buck at the beginning. It more sounds like you are trying to solve the symptom instead of the problem (also performance concerns with that many styles). – SciSpear Aug 21 '12 at 17:18
  • I was about to say `grep -c -e \{ style.css` – Jay Aug 21 '12 at 17:19
  • This SO question addresses your problem: http://stackoverflow.com/questions/5228459/selector-count-in-css However yeah, if you have that many rules you probably want to think about refactoring your CSS to be more generalized. Here's another SO for that: http://stackoverflow.com/questions/2253110/managing-css-explosion – numbers1311407 Aug 21 '12 at 17:20

1 Answers1

1

Through the command-line: You could pass the html file to grep, and do a word count on the occurences of css.

grep css index.html | wc -l
Andrew G.
  • 440
  • 4
  • 10
Andrew C
  • 42
  • 2