-
Notifications
You must be signed in to change notification settings - Fork 88
/
index.js
29 lines (25 loc) · 932 Bytes
/
index.js
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
29
const postcss = require('postcss')
const params = require('./lib/params')
const formatAtRules = require('./lib/formatAtRules')
const formatOrder = require('./lib/formatOrder')
const formatRules = require('./lib/formatRules')
const formatComments = require('./lib/formatComments')
const formatSassVariables = require('./lib/formatSassVariables')
const stylefmt = postcss.plugin('stylefmt', function (options) {
var paramer = params(options)
return function (root, result) {
return paramer(root, result).then(function (params) {
if(params) {
formatComments(root, params)
formatAtRules(root, params)
formatRules(root, params)
formatSassVariables(root, params)
// order should be the last to prevent empty line collapse in order rules
formatOrder(root, params)
}
}).catch(function (err) {
console.error(err.stack)
})
}
})
module.exports = stylefmt