forked from Ember-Swiper/ember-cli-swiper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
42 lines (33 loc) · 1.08 KB
/
index.js
File metadata and controls
42 lines (33 loc) · 1.08 KB
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
/* eslint-env node */
'use strict';
var map = require('broccoli-stew').map;
var path = require('path');
var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ember-cli-swiper',
treeForVendor: function(defaultTree) {
var trees = [];
var swiperPath = path.join(path.dirname(require.resolve('swiper')), '..');
var browserVendorLib = new Funnel(swiperPath, {
destDir: 'swiper',
include: ['js/swiper.min.js', 'css/swiper.min.css']
});
browserVendorLib = map(browserVendorLib, (content, relativePath) => {
if (relativePath.indexOf('css') !== -1) {
return content;
}
return `if (typeof FastBoot === 'undefined') { ${content} }`
});
if (defaultTree !== undefined) {
trees.push(defaultTree);
}
trees.push(browserVendorLib);
return new mergeTrees(trees);
},
included: function(app) {
this._super.included.apply(this, arguments);
this.app.import('vendor/swiper/js/swiper.min.js');
this.app.import('vendor/swiper/css/swiper.min.css');
}
};