Re: [idead] cssdiff

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 UTC