-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
83 lines (70 loc) · 1.96 KB
/
index.js
File metadata and controls
83 lines (70 loc) · 1.96 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* eslint-env node */
'use strict';
module.exports = {
name: 'ember-stylish-buttons',
included: function(app, parentAddon) {
var target = (parentAddon || app);
// necessary for nested usage
// parent addon should call `this._super.included.apply(this, arguments);`
if(target.app) {
target = target.app;
}
this.app = target;
// Use configuration to decide which theme css files
// to import, thus not populating the user's app
this.importThemes(target);
this._super.included.apply(this, arguments);
},
importThemes: function(app) {
var projectConfig = this.project.config(app.env);
var config = projectConfig['ember-stylish-buttons'] || {};
var themes = [];
var excludedBaseStyles = false;
if(config) {
var allThemes = [
'antiman',
'aylen',
'isi',
'itzel',
'moema',
'naira',
'nina',
'nuka',
'pipaluk',
'quidel',
'rayen',
'sacnite',
'saqui',
'shikoba',
'tamaya',
'ujarak',
'wapasha',
'wayra',
'winona'
];
var included = config.includedThemes;
var excluded = config.excludedThemes;
excludedBaseStyles = config.excludeBaseStyles || false;
if(included && Array.isArray(included)) {
themes = themes.concat(included);
} else {
themes = allThemes;
}
if(excluded && Array.isArray(excluded)) {
themes = themes.filter(function(theme) {
return excluded.indexOf(theme) === -1;
});
}
themes = themes.filter(function(theme) {
return theme && allThemes.indexOf(theme) !== -1;
});
}
if(!excludedBaseStyles) {
app.import('vendor/ember-stylish-buttons/base.css');
}
themes = themes.length ? themes : ['winona'];
themes.forEach(function(theme) {
app.import('vendor/ember-stylish-buttons/themes/' + theme + '.css');
});
}
};