forked from csscomb/sublime-csscomb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsscomb.js
More file actions
29 lines (22 loc) · 636 Bytes
/
csscomb.js
File metadata and controls
29 lines (22 loc) · 636 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var str = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) {
str += data;
});
process.stdin.on('end', function () {
var Comb = require('./node_modules/csscomb/lib/csscomb'),
comb = new Comb(),
syntax = process.argv[2],
config, combed;
try {
config = JSON.parse(process.argv[3]);
} catch (e) {
config = null;
}
config = Comb.getCustomConfig() ||
config ||
Comb.getConfig('csscomb');
combed = comb.configure(config).processString(str, {syntax: syntax});
process.stdout.write(combed);
});