forked from ember-bootstrap/ember-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
67 lines (54 loc) · 2.12 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
/* jshint node: true */
'use strict';
var path = require('path'),
util = require('util'),
extend = util._extend,
mergeTrees = require('broccoli-merge-trees'),
Funnel = require('broccoli-funnel');
var defaultOptions = {
importBootstrapTheme: false,
importBootstrapCSS: true,
importBootstrapFont: true
};
module.exports = {
name: 'ember-bootstrap',
included: function included(app) {
// workaround for https://github.com/ember-cli/ember-cli/issues/3718
if (typeof app.import !== 'function' && app.app) {
app = app.app;
}
this.app = app;
var options = extend(defaultOptions, app.options['ember-bootstrap']);
var bootstrapPath = path.join(app.bowerDirectory, 'bootstrap/dist');
// Import css from bootstrap
if (options.importBootstrapCSS) {
app.import(path.join(bootstrapPath, 'css/bootstrap.css'));
app.import(path.join(bootstrapPath, 'css/bootstrap.css.map'), {destDir: 'assets'});
}
if (options.importBootstrapTheme) {
app.import(path.join(bootstrapPath, 'css/bootstrap-theme.css'));
}
// Import glyphicons
if (options.importBootstrapFont) {
app.import(path.join(bootstrapPath, 'fonts/glyphicons-halflings-regular.eot'), {destDir: '/fonts'});
app.import(path.join(bootstrapPath, 'fonts/glyphicons-halflings-regular.svg'), {destDir: '/fonts'});
app.import(path.join(bootstrapPath, 'fonts/glyphicons-halflings-regular.ttf'), {destDir: '/fonts'});
app.import(path.join(bootstrapPath, 'fonts/glyphicons-halflings-regular.woff'), {destDir: '/fonts'});
app.import(path.join(bootstrapPath, 'fonts/glyphicons-halflings-regular.woff2'), {destDir: '/fonts'});
}
app.import('vendor/transition.js');
},
treeForStyles: function treeForStyles(tree) {
var styleTrees = [];
if (this.app.project.findAddonByName('ember-cli-less')) {
var lessTree = new Funnel(path.join(this.app.bowerDirectory, 'bootstrap/less'), {
destDir: 'ember-bootstrap'
});
styleTrees.push(lessTree);
}
if (tree) {
styleTrees.push(tree);
}
return mergeTrees(styleTrees, { overwrite: true });
}
};