csssemantic-diff

Tool to parse and compare two CSS stylesheets


Does anyone know of a good tool that can parse and compare two CSS stylesheets in order to find which selectors have different styles?

I cannot use a standard diff-like tool because the two CSS files have very different layout. I need a tool that can parse and understand the CSS, then look for selectors that actually have different styles in the two stylesheets.

The only tool I've found is the CSS Comparer from Alan Hart, however it gets confused when there are styles that apply to multiple selectors.


Solution

  • Here's what I ended up doing, in case someone else has the same problem:

    1. I used CSSTidy to "normalize" the two stylesheets I wanted to compare. Normalization in my case meant splitting multiple selectors and sorting selectors and properties. An online version of CSSTidy is available here.
    2. After this, I used the CSS Comparer tool from Alan Hart to find out differences between the two stylesheets.

    This did the job for my specific requirements.