How to compress CSS files with PHP?

In this post I will present a class I wrote for CSS compression. I know there are some scripts which can do this, but maybe someone will find mine somehow better :)

The code is simple and the whole thing runs fast. It removes unnecessary elements such as comments, whitespaces, tries to compress colors and so on. It can also output gzip compressed CSS.

Optimizing gif, jpg, png, html, css and js files

Kashmir Web Optimizer is a simple-to-use Windows application which can compress website specific files like CSS, JS, HTML, GIF, PNG and JPEG. The compression is lossless, so no real information is removed.

For JPEG files the application is mostly removing EXIF sections and comments. PNG and GIF files are recompressed with stronger compression. From HTML, JS and CSS files it is removing comments and unnecessary whitespace characters. And does even more!

 
TopOfBlogs Web Development & Design Blogs