csscomb/csscomb.js — pull request #249 by tonyganch (2014-07-03 23:27:41+00:00)
Title: Plugin API

/cc @kizu

So...
No more constants in `csscomb.js`.
Every option is a plugin which uses new Plugin API (see #236).

A plugin must have following fields:
- `{String} name` – option's name
- `{Array} syntax` – list of supported syntaxes
- `{Function} process` – method to transform AST nodes

One of following fields should be used for setting values:
- `{Object} accepts` – should be used for simple values that accept boolean or integer values
- `{Function} setValue` – method that returns value (see `sort-order` for example)

In order to process options in a particular order a developer can set `{String} runBefore` property.

`{Function} detect` is optional.

This is an example of using an external plugin:
```js
var optionA = require('path/to/optionA');
var optionB = require('path/to/optionB');

comb.use(optionA)
.use(optionB)
.configure({ 'option-a': true, 'option-b': 100, 'block-indent': '\t' })
.processString(css);
```

It lacks documentation, but you can touch code.
Discuss!

![anigif_enhanced-buzz-18722-1374079813-17](https://cloud.githubusercontent.com/assets/872004/3476845/21ad9cd4-0309-11e4-8291-eb8b2e76122f.gif)