SublimeCSSTidy is a Sublime Text 2 package for cleaning and tidying up your CSS. It's mostly a wrapper for the CSS Tidy PHP Library, but it will fall back on a bundled CSS Tidy executable for Windows users without PHP (the exe isn't recommended for CSS3, take care).
SublimeCSSTidy adds three commands to the Sublime Text 2 command palette:
- Tidy CSS (Highest Compression)
- Tidy CSS (Low Compression)
- Tidy CSS
The last command uses the default template, which balances readability and compression. If you can decipher the complicated pattern for creating custom formatting rules, SublimeCSSTidy will happily use them. An example of a custom template file is included (
csstidy.sublime-settings for a documented list of options.
If you have Package Control installed, you can install SublimeCSSTidy from within Sublime Text 2. Open the Command Palette and enter "Package Control: Install Package", then search for CSSTidy.
Clone the repository into your Sublime Text 2 packages directory:
git clone git://github.com/fitnr/SublimeCSSTidy.git
Go to the download section and download the package. Unzip it, rename the folder CSSTidy and move it into your Sublime Text 2 packages directory (Preferences > Browse Packages in the menu)