forked from mainmatter/ember-promise-modals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
45 lines (36 loc) · 1.1 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
40
41
42
43
44
45
'use strict';
const funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
const BroccoliPostCSS = require('broccoli-postcss');
const postcssPresetEnv = require('postcss-preset-env');
const pkg = require('./package.json');
module.exports = {
name: require('./package').name,
treeForAddon() {
const tree = this._super(...arguments);
const app = this._findHost();
const options = typeof app.options === 'object' ? app.options : {};
const addonConfig = options[pkg.name] || {};
const addonWithoutStyles = funnel(tree, {
exclude: ['**/*.css'],
});
if (addonConfig.excludeCSS === true) {
return addonWithoutStyles;
}
const addonStyles = funnel(tree, {
include: ['**/*.css'],
});
const processedStyles = new BroccoliPostCSS(addonStyles, {
plugins: [
{
module: postcssPresetEnv,
options: {
stage: 3,
overrideBrowserslist: app.project._targets.browsers,
},
},
],
});
return mergeTrees([addonWithoutStyles, processedStyles]);
},
};