forked from rajasegar/ember-x-tabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
81 lines (66 loc) · 1.87 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
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
/* eslint-env node */
'use strict';
module.exports = {
name: require('./package').name,
included(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(app) {
var projectConfig = this.project.config(app.env);
var config = projectConfig['ember-x-tabs'] || {};
var themes = [];
var excludedBaseStyles = false;
if (config) {
var allThemes = [
'bar',
'circle',
'circlefill',
'fillup',
'flip',
'iconbox',
'iconfall',
'line',
'linebox',
'linemove',
'linetriangle',
'shape',
'topline',
'tzoid',
'underline'
];
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-x-tabs/base.css');
}
themes = themes.length ? themes : ['bar'];
themes.forEach(function(theme) {
app.import('vendor/ember-x-tabs/themes/' + theme + '.css');
});
}
};