/
index.js
35 lines (26 loc) · 819 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
/* jshint node: true */
'use strict';
var autoprefixer = require('broccoli-autoprefixer');
var defaults = require('lodash/defaults');
module.exports = {
name: 'ember-cli-autoprefixer',
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 = defaults(this.app.options.autoprefixer || {}, {
browsers: this.project.targets && this.project.targets.browsers,
enabled: true
});
this.enabled = this.options.enabled;
delete this.options.enabled;
},
postprocessTree: function(type, tree) {
if ((type === 'all' || type === 'styles') && this.enabled) {
tree = autoprefixer(tree, this.options);
}
return tree;
}
};