csscomb/csscomb.js — pull request #88 by tonyganch (2013-10-15 21:39:11+00:00)
Title: [WIP] Support sorting in *.scss files

This is a **WIP** pull request for a nonexistent issue.
It's based on my [rework](https://github.com/tonyganch/gonzales-pe) of [gonzales](https://github.com/css/gonzales).
Please, do not push anything to this branch.

Caveats:

- I've changed gonzales' API: methods are renamed, all arguments are passed as one object, syntax name is a new optional argument (`css` is default).

- Syntax is detected by getting file's extension ([link](https://github.com/csscomb/csscomb.js/compare/tg;scss#diff-3c7b8192946199fb9cd6f50f56b8694fR131)). It's not a good way though, because file `nani.css.scss.foo` can be a valid scss stylesheet.

- There are two kinds of comments now: multi-line (`/* nani */`) and single-line (`// nani`). More tests should be added to check that SL comments are handled fine.

- I rewrote a sorting method (`process()` in `options/sort-order.js`) almost from scratch. The original idea of extending nodes is nice, so I've used it.

- One test was commented out ([link](https://github.com/csscomb/csscomb.js/compare/tg;scss#diff-58490fd0e67d0ea38135cd925ff23958R120)). I think we should move it to some other place.

- There are now 3 special keywords that can be used in sort order: `$variable`, `$import` and `$include`. I'm a bit tired of some people asking to move includes to the top of a ruleset, and others – to the bottom. So let them decide. Config can look like this:
```
{ 'sort-order': [
['$variable'],
['$import', 'color']
] }
```
Note that `$include` means both `@include` and `@extend` in Sass terms.

![tumblr_m50aj7qq0h1r4xjo2o1_500](https://f.cloud.github.com/assets/872004/1338160/149101b6-35e2-11e3-844f-4f19583f1dee.jpg)