W3C home > Mailing lists > Public > public-qa-dev@w3.org > January 2009

Re: [idead] cssdiff

From: olivier Thereaux <ot@w3.org>
Date: Fri, 23 Jan 2009 15:24:26 -0500
Cc: Jean-Guilhem Rouel <jean-gui@w3.org>, "public-qa-dev@w3.org list" <public-qa-dev@w3.org>
Message-Id: <2007E165-DBE7-4079-8738-20A89320D21C@w3.org>
To: Karl Dubost <karl+w3c@la-grange.net>

Hi Karl,

On 23-Jan-09, at 2:44 PM, Karl Dubost wrote:
> I wanted to compare two css so I started to look for something  
> around. There is already indeed a [service][1] which was created a  
> while ago it seems. Unfortunately it doesn't seem to be working very  
> well.
>
> I was wondering how hard it would be to create such a service and/or  
> program.
> The results could hide things in common and just show the differences.

I don't think I ever saw any good CSS-specific diff engine. Given the  
number of (open source) CSS parser existing, I suspect it wouldn't be  
too too hard to do. What you need is:

1) a CSS parser. Ideally somewhat fault tolerant, at least tolerant to  
a good number of typos

2) your parser should be able to serialize what it parsed in a  
normalized way. (whatever the normalization)

3) diff on the above. Voila!

In a way, the CSS validator does most of that. When you validate a CSS  
file, it will output the (cleaneed-up) result of its parsing. In  
theory, one could do that twice and compare. The brave could take the  
XML output of the CSS validator (although I would really not recommend  
that) and place the burden on one of the available XML diffing tool.  
The very brave could take the CSS parser from the CSS validator and do  
that in Java.

There's this, too, in (y)our language of choice - a parser to build upon
http://code.google.com/p/cssutils/

-- 
olivier
Received on Friday, 23 January 2009 20:24:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 19 August 2010 18:12:49 GMT