I'm a big fan of SquishIt, which is a library that compresses and minifies CSS and JS. It automatically keeps thing uncompressed locally and then on your web server, versions and compresses your files. The versioning is based on a checksum of your files so it automatically handles any changes you make, it's gold.
The thing that I don't like is that by default, it writes to your file system which is usually a no-no on shared hosts or even enterprise applications.
I asked if you could use SquishIt programmatically and you can! I wrote up a wiki article on their project page to show how it's done.
If you haven't used SquishIt, I'd highly recommend it!