W3C home > Mailing lists > Public > www-style@w3.org > May 2009

Re: how to normalize redundant CSS?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 19 May 2009 22:32:29 -0500
Message-ID: <dd0fbad0905192032s2ae95d55i61e45bc1bfd0c286@mail.gmail.com>
To: Phlip <phlip2005@gmail.com>
Cc: www-style@w3.org
On Sun, May 17, 2009 at 10:40 AM, Phlip <phlip2005@gmail.com> 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
number).

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

~TJ
Received on Wednesday, 20 May 2009 03:33:09 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:18 GMT