forked from knownasilya/ember-toggle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (38 loc) · 1.2 KB
/
index.js
File metadata and controls
48 lines (38 loc) · 1.2 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
/* jshint node: true */
'use strict';
module.exports = {
name: 'ember-cli-toggle',
included: function(app) {
app.import('vendor/ember-cli-toggle/base.css');
// Use configuration to decide which theme css files
// to import, thus not populating the user's app
this.importThemes(app);
},
importThemes: function(app) {
var projectConfig = this.project.config(app.env);
var config = projectConfig['ember-cli-toggle'];
if (config) {
var allThemes = ['light', 'ios', 'default', 'flat', 'skewed', 'flip'];
var included = config.includedThemes;
var excluded = config.excludedThemes;
var themes = [];
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;
});
themes.forEach(function (theme) {
app.import('vendor/ember-cli-toggle/themes/' + theme + '.css');
});
}
}
};