CSSTidy is an open source application that parses, fixes, and optimizes CSS code to standardize CSS code formatting automatically. It is available as executeable file (available for Windows, Linux and OSX) which can be controlled per command line and as PHP script (both with almost the same functionality).
CSSTidy finds and removes redundant styles and properties. You can adjust CSSTidy’s settings to your preferred compression level but even the default setting can often give you 30% compression according to the creators of CSSTidy.
Features:
- colours like black or rgb(0,0,0) are converted to #000000 or rather #000 if possible. Some hex-codes are replaced by their colour names if they are shorter.
- all unnecessary whitespace is removed, depending on the compression-level
- all background-properties are merged
- all comments are removed
- the last semicolon in every block can be removed
- missing semicolons are added, incorrect newlines in strings are fixed, missing units are added, bad colors (and color names) are fixed
Be the first to comment