slimmer.py is a whitespace optimizer for CSS, HTML and XHTML output. It's written by Peter Bengtsson.
This module removes unnecessary whitespace from CSS. The primary requirement developing this module is to not break working stylesheets: if working CSS is in input then working CSS is output. The Mac/Internet Explorer comment hack will be minimized but not stripped and so will continue to function.
This module understands space, horizontal tab, new line, carriage return, and form feed characters to be whitespace. Any other characters that may be considered whitespace are not minimized. These other characters include paragraph separator and vertical tab.
For static CSS files, it is recommended that you minify during the build stage of web deployment. If you minify on-the-fly then it might be a good idea to cache the minified file. Minifying static files on-the-fly repeatedly is wasteful.
The ECMAScript specifications allow for many different whitespace characters: space, horizontal tab, vertical tab, new line, carriage return, form feed, and paragraph separator. This module understands all of these as whitespace except for vertical tab and paragraph separator. These two types of whitespace are not minimized.