Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing and rationalizing CSS - not file or diff based

I'm in the process of taking a couple of separate asp.net applications, and combining them.

One problem is rationalizing the CSS between the two app - app1 has two css files, while app2 has about 8 of them. Much of the CSS between the two apps is the same, but there are some differences. I'm looking for a tool to compare all the elements of each app, and show what's missing, what's different, etc. Ideally the output would be 3 files: Common, app1 and app2, but I won't be that fussy if it can just show me the differences between the two apps.

Does such a tool exist?

like image 910
chris Avatar asked May 12 '09 16:05

chris


3 Answers

If you hate downloading tools, there's an online version of css comparer here http://www.alanhart.co.uk/tools/compare-css.php

It provides a comparison of css class files between two files

like image 104
Whimsical Avatar answered Oct 06 '22 01:10

Whimsical


I don't know of a stand-alone tool tailored for this specific purpose. There's a PHP class called "CSS Comparer", but I have no idea how easy it is to use. The screenshot on that page looks promising though.

Personally, I would probably just concatenate all the files together, so that you have one file for each app, and then run a diff on them. To make it even easier, you could run both files through something like CSSTidy or do some imaginative file processing with search/replace and sorting. That could get all the declarations in the same order in both files, so the diff would be clearer.

like image 31
Chad Birch Avatar answered Oct 06 '22 00:10

Chad Birch


Combine all of these files into a single file and give it a run through a CSS optimizer or compressor. An optimizer should see all of your duplicate selectors and weed them out.

I'd recommend YUI's compressor, but there are plenty of web-based compressors/optimizers available, too. Here's one and another. YMMV with them, but a good Google search can turn up a bunch more.

like image 31
ajm Avatar answered Oct 06 '22 01:10

ajm