-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
39 lines (34 loc) · 1.18 KB
/
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
30
31
32
33
34
35
36
37
38
39
var postcss = require('postcss')
var autoprefixer = require('autoprefixer')
var constant = require('postcss-annotation-constant')
var csswring = require('csswring')
var include = require('postcss-annotation-include')
var important = require('postcss-important')
var imprt = require('postcss-import')
var extend = require('postcss-annotation-extend')
var constantBlock = require('postcss-atcss-constant')
var inherit = require('postcss-atcss-inherit')
var removeBase = require('postcss-remove-base')
module.exports = Atcss
function Atcss (css, options) {
if (!this instanceof Atcss) return new Atcss(css, options)
options = options || {}
this.css = css
this.compress = options.compress
}
Atcss.prototype.process = function () {
var output = postcss()
.use(imprt())
.use(constant(this.css))
.use(constantBlock(this.css))
.use(include({css: this.css, removeBase: false}))
.use(extend(this.css))
.use(inherit(this.css))
.use(removeBase())
.use(important(this.css))
.use(autoprefixer.postcss);
if (this.compress) {
output = output.use(csswring.postcss)
}
return output.process(this.css).css
}