Tool for sorting CSS properties in specific order
Pull request Compare This branch is 129 commits behind csscomb:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Tool for sorting CSS properties in specific order

  • Sorting CSS properties: The order of properties in the help of professionals
  • Setting the order of CSS properties: Use the order to which you are accustomed to
  • Parsing CSS in the tags style tag, style attribute: CSScomb find a CSS-code to other languages and will sort it
  • Formatting style sheets does not change: Work as a singleline and multiline CSS
  • Separation of CSS properties for the group: Separate groups of empty string if you want
  • Full support CSS2/CSS2.1/CSS3: CSScomb ready for the advanced CSS-code

The algorithm of CSScomb simulates web-technologist's actions upon working with CSS-code to the limit. Usually to re-order code you move lines over each other considering comments in the code, multilines records of property values, hacks and everything that could be found in the real file. CSScomb reproduces these actions for you. This means that the parser "thinks" as a person editing the text, not as a blind robot parsing CSS.

Download plugins

  • Sublime Text 2 plugin
  • TextMate plugin
  • Coda Plugin
  • Coda 2 Plugin
  • Espresso 2 plugin
  • IntelliJIDEA Plugin
  • WebStorm Plugin
  • PyCharm plugin
  • Notepad ++ Plugin
  • Vim Plugin

CLI usage

Avaliable at /build/cli/

% 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