Re: how to normalize redundant CSS?

On Sun, May 17, 2009 at 10:40 AM, Phlip <> wrote:
> Phlip wrote:
>> Does anyone know a tool that reads a page's CSS, normalizes it into one
>> flat stoopid file, with all the duplication taken out?
> I just...
>  - saved the whole page with Firefox
>  - went into the saved folder
>  - cat *.css >all.css
>  - csstidy all.css >simple.css
>  - pasted simple.css into (hopefully) my lowest CSS file
>  - refreshed the browser cache
>  - refreshed the page
>  - nothing twitched!
> The problem with this approach is CSStidy did not reach into my HTML and
> merge all the redundant style class attributes. That means if the old system
> had the same class repeated many times with different names, the new system
> still uses that. I'm bloody aware that a CSS tool cannot reach into my raw
> HTML source (which happens to be HAML), but a feeb attempt would have been
> nice. Thots?

I can't give you a site-wide solution, but the Firebug extension for
Firefox is wondrous for handling this on an element-by-element basis.
It shows you exactly which rules apply to an element, which ones have
been superceded, and where each rule comes from (document and line

Using this, you can at least figure out where to go to alter something
like a float:left to float:right.


Received on Wednesday, 20 May 2009 03:33:09 UTC