Menu

CSSTidy 1.0 final released

Today CSSTidy 1.0 has been released. This version mostly fixes bugs that have been found in the beta version and should be stable now.
Version 1.1 will follow soon, the most important new feature for this version will be the option to save comments.

CSSTidy is a program (C++)/script (PHP) that optimises, fixes and formats CSS code, so it is supposed to be the HTMLTidy for CSS. The core of CSSTidy is a CSS parser that does *not* use any regular expressions which makes CSSTidy more reliable than many other scripts/programs in this vein.

Features (margin stands for all properties of that type):

* 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.

* a{property:x;property:y;} becomes a{property:y;} (all duplicate properties are merged)

* margin:1px 1px 1px 1px; becomes margin:1px;

* margin:0px; becomes margin:0;

* a{margin-top:10px; margin-bottom:10px; margin-left:10px; margin-right:10px;} becomes a{margin:10px;}

* margin:010.0px; becomes margin:10px;

* 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

* property:value ! important; becomes property:value !important;

More information on its usage you can find on the project homepage:
http://csstidy.sourceforge.net/usage.php

Download:
C++: https://sourceforge.net/project/showfiles.php?group_id=148404&package_id=166585
PHP: https://sourceforge.net/project/showfiles.php?group_id=148404&package_id=166584

An online version is also available:
http://cdburnerxp.se/cssparse/css_optimiser.php

Posted by Floele 2005-10-29

Log in to post a comment.