! DEPRECATED ! Please use csscomb.js instead
PHP JavaScript CSS
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src close finfo. fix memory leak Nov 26, 2013
www Web: Update links Nov 9, 2013
.gitignore Add yuicompressor to repo Jun 3, 2013
CHANGELOG.md Release 2.13 version: Jun 12, 2013
LICENSE Rename License file Jan 7, 2013
Makefile Update plugins Jul 8, 2013
README.mkd Shout about deprecated status Dec 16, 2013
yuicompressor-2.4.7.jar Add yuicompressor to repo Jun 3, 2013



This version of CSScomb is no longer supported, guys.
We have a new super cool Node.js version instead!

Tool for sorting CSS properties

  • Sorts CSS properties into a logical, consistent order
  • Allows for custom sorting of CSS properties (set it to whatever order you're accustomed to)
  • Parses CSS in style tags and style attributes -- can comb other languages for CSS as well
  • Does not change existing formatting of style sheets --target single or multiple lines of CSS
  • Separates CSS properties into groups (you can have groups of empty strings, if you want)
  • Fully supports CSS2/CSS2.1/CSS3

The CSScomb algorithm simulates a web developer's judgment in ordering CSS styles. You can spend tons of time re-ordering code--moving lines over each other, working around comments in the code, moving multi-line sets of property values, and all sorts of hacking to make your code more readable. CSScomb takes care of these tasks for you. It "thinks" like a person editing the text, not as a blind robot parsing CSS.


The Requirements

CSScomb is written in pure PHP, without any external libraries or dependencies. See details at wiki.

Download plugins

  • Sublime Text 2 plugin avaliable in Package Control as 'CSScomb'
  • TextMate plugin
  • Coda plugin
  • Coda 2 plugin
  • Espresso 2 plugin (How to install)
  • IntelliJIDEA plugin
  • WebStorm plugin
  • PyCharm plugin
  • Notepad ++ plugin
  • Chocolat Mixin
  • Vim Plugin

CLI usage

Available at csscomb.com

% php csscomb.php

Command line tool for resort CSS code.

    $ php csscomb.php -s <file with JSON array> -i <path to input css file> -o <path to result css file>

    -s, --sort-order    specify file with custom sort order. File must contain JSON data. For detail information run 'csscomb.php --help-sort-order'
    -i, --input         must be directory name or file that needs to be sorted
    -o, --output        sort result file. Use output when input is not a directory name, otherwise output param ignored. If output filename does not exist, the file is created. Otherwise, the existing file is overwritten.

    --help, -help, -h, -? or no options will print this man.

    csscomb.php -s my-custom-sort-order.json -i css/style.css -o css/style-resorted.css

    csscomb.php -i some_directory_name