forked from antgrimmitt/ember-mapbox-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
56 lines (44 loc) · 1.19 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
/* eslint-env node */
'use strict';
const Funnel = require('broccoli-funnel');
const MergeTrees = require('broccoli-merge-trees');
const Path = require('path');
module.exports = {
name: 'ember-mapbox-gl',
treeForStyles(tree) {
const mapboxGlTree = new Funnel(Path.dirname(require.resolve('mapbox-gl')), {
files: [ 'mapbox-gl.css' ],
destDir: 'app/styles'
});
if (tree) {
return new MergeTrees([ tree, mapboxGlTree ]);
}
return mapboxGlTree;
},
treeForVendor(tree) {
const mapboxGlTree = new Funnel(Path.dirname(require.resolve('mapbox-gl')), {
files: [
'mapbox-gl.js',
'mapbox-gl.js.map',
'mapbox-gl-dev.js'
],
destDir: '/mapbox-gl'
});
if (tree) {
return new MergeTrees([ tree, mapboxGlTree ]);
}
return mapboxGlTree;
},
included(app) {
this._super.included.apply(this, arguments);
const srcFile = process.env.EMBER_ENV === 'production'
? 'vendor/mapbox-gl/mapbox-gl.js'
: 'vendor/mapbox-gl/mapbox-gl-dev.js';
app.import(srcFile, {
using: [
{ transformation: 'amd', as: 'mapbox-gl' }
]
});
app.import('app/styles/mapbox-gl.css');
}
};