forked from montoias/ember-cli-mapbox
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
45 lines (35 loc) · 1.22 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
/* eslint-env node */
'use strict';
var path = require('path');
var Funnel = require('broccoli-funnel');
module.exports = {
name: 'ember-cli-mapbox',
configKeyName: 'mapbox',
included: function(app, parentAddon) {
this._super.included.apply(this, arguments);
var target = parentAddon || app;
if (target.app) {
target = target.app;
}
var config = target.project.config(target.env) || {};
var addonConfig = config[this.configKeyName] || {};
// Mapbox
app.import(app.bowerDirectory + '/mapbox.js/mapbox.js');
app.import(app.bowerDirectory + '/mapbox.js/mapbox.css');
// Leaflet markercluster
if (addonConfig.excludeCluster) {
return;
}
app.import(app.bowerDirectory + '/leaflet.markerclusterer/dist/leaflet.markercluster.js');
app.import(app.bowerDirectory + '/leaflet.markerclusterer/dist/MarkerCluster.css');
app.import(app.bowerDirectory + '/leaflet.markerclusterer/dist/MarkerCluster.Default.css');
},
treeForPublic: function() {
var mapboxPath = path.join(this.app.bowerDirectory, 'mapbox.js');
var mapboxTree = new Funnel(this.treeGenerator(mapboxPath), {
srcDir: '/images',
destDir: '/assets/images'
});
return mapboxTree;
}
};