forked from ahmadsoe/ember-highcharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
61 lines (47 loc) · 1.58 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
/* jshint node: true */
'use strict';
var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var path = require('path');
module.exports = {
name: 'ember-highcharts',
included: function(target) {
this._super.included.apply(this, arguments);
var app = target.app || target;
var options = app.options.emberHighCharts || { includeHighCharts: true };
var highchartsPath = 'vendor/highcharts';
if (options.includeHighCharts || options.includeHighCharts3D) {
app.import(path.join(highchartsPath, 'highcharts.src.js'));
}
if (options.includeHighStock) {
app.import(path.join(highchartsPath, 'highstock.src.js'));
}
if (options.includeHighMaps) {
app.import(path.join(highchartsPath, 'highmaps.src.js'));
}
if (options.includeHighChartsMore) {
app.import(path.join(highchartsPath, 'highcharts-more.src.js'));
}
if (options.includeHighCharts3D) {
app.import(path.join(highchartsPath, 'highcharts-3d.src.js'));
}
if (options.includeModules) {
var modules = options.includeModules;
for (var i = 0; i < modules.length; i++) {
var moduleFilename = modules[i] + '.src.js';
app.import(path.join(highchartsPath, 'modules', moduleFilename));
}
}
},
treeForVendor: function(vendorTree) {
var trees = [];
var highchartsPath = path.dirname(require.resolve('highcharts'));
if (vendorTree) {
trees.push(vendorTree);
}
trees.push(new Funnel(highchartsPath, {
destDir: 'highcharts'
}));
return mergeTrees(trees);
}
};