-
Notifications
You must be signed in to change notification settings - Fork 25
/
index.js
37 lines (28 loc) · 852 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
30
31
32
33
34
35
36
37
'use strict';
const Autoprefixer = require('broccoli-autoprefixer');
const treesToProcess = ['css', 'less', 'styl', 'scss', 'sass'];
module.exports = {
name: require('./package').name,
included: function(app) {
this.app = app;
if (typeof app.import !== 'function' && app.app) {
this.app = app = app.app;
}
this._super.included.apply(this, arguments);
this.options = Object.assign(
{
overrideBrowserslist: this.project.targets && this.project.targets.browsers,
enabled: true
},
this.app.options.autoprefixer || {}
);
this.enabled = this.options.enabled;
delete this.options.enabled;
},
postprocessTree: function(type, tree) {
if (this.enabled && treesToProcess.includes(type)) {
tree = new Autoprefixer(tree, this.options);
}
return tree;
}
};