-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
94 lines (86 loc) · 2.84 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
82
83
84
85
86
87
88
89
90
91
92
93
94
/* jshint node: true */
'use strict';
var path = require('path');
var DEFAULT_OPTIONS = {
importOnsenuiCSS: true,
importFontAwesome: true,
importIonIcons: true,
importMaterialDesignIcons: true,
importTheme: 'default'
};
module.exports = {
name: 'ember-onsenui',
included: function included(app) {
this._super.included(app);
var options = Object.assign({}, DEFAULT_OPTIONS, app.options['emberOnsenui']);
var onsenuiPath = path.join(app.bowerDirectory, 'onsenui');
if (options.importOnsenuiCSS) {
app.import(path.join(onsenuiPath, 'css/onsenui.css'));
if (options.importTheme && options.importTheme !== 'default') {
app.import(path.join(onsenuiPath, 'css/onsen-css-components-' + options.importTheme + '-theme.css'));
} else {
app.import(path.join(onsenuiPath, 'css/onsen-css-components-default.css'));
}
}
if (options.importFontAwesome) {
app.import(
path.join(onsenuiPath, 'css/font_awesome/css/font-awesome.min.css'),
{outputFile: 'assets/font_awesome/css/font-awesome.min.css'}
);
[
'fontawesome-webfont.eot',
'fontawesome-webfont.svg',
'fontawesome-webfont.ttf',
'fontawesome-webfont.woff',
'fontawesome-webfont.woff2',
'FontAwesome.otf'
].forEach(function (fontName) {
app.import(
path.join(onsenuiPath, 'css/font_awesome/fonts', fontName),
{destDir: 'assets/font_awesome/fonts'}
);
});
}
if (options.importIonIcons) {
app.import(
path.join(onsenuiPath, 'css/ionicons/css/ionicons.min.css'),
{outputFile: 'assets/ionicons/css/ionicons.min.css'}
);
[
'ionicons.eot',
'ionicons.svg',
'ionicons.ttf',
'ionicons.woff'
].forEach(function (fontName) {
app.import(
path.join(onsenuiPath, 'css/ionicons/fonts', fontName),
{destDir: 'assets/ionicons/fonts'}
);
});
}
if (options.importMaterialDesignIcons) {
app.import(
path.join(onsenuiPath, 'css/material-design-iconic-font/css/material-design-iconic-font.min.css'),
{outputFile: 'assets/material-design-iconic-font/css/material-design-iconic-font.min.css'}
);
[
'Material-Design-Iconic-Font.eot',
'Material-Design-Iconic-Font.svg',
'Material-Design-Iconic-Font.ttf',
'Material-Design-Iconic-Font.woff',
'Material-Design-Iconic-Font.woff2'
].forEach(function (fontName) {
app.import(
path.join(onsenuiPath, 'css/material-design-iconic-font/fonts', fontName),
{destDir: 'assets/material-design-iconic-font/fonts'}
);
});
}
app.import(path.join(onsenuiPath, 'js/onsenui.js'));
app.import('vendor/onsenui.js', {
exports: {
onsenui: ['default']
}
});
}
};