forked from matype/stylefmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
28 lines (24 loc) · 850 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
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)
formatOrder(root, params)
formatRules(root, params)
formatSassVariables(root, params)
}
}).catch(function (err) {
console.error(err.stack)
})
}
})
module.exports = stylefmt