forked from FutoRicky/ember-cli-dropzonejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (38 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
/* eslint-env node */
/* jshint node: true */
'use strict';
var path = require('path');
var MergeTrees = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');
var map = require('broccoli-stew').map;
module.exports = {
name: 'ember-cli-dropzonejs',
treeForVendor(vendorTree) {
var dropzoneJs = new Funnel(
path.join(this.project.root, 'node_modules', 'dropzone/dist/min'),
{ files: ['dropzone.min.js'] }
);
dropzoneJs = map(
dropzoneJs,
content => `if (typeof FastBoot === 'undefined') { ${content} }`
);
return vendorTree ? new MergeTrees([vendorTree, dropzoneJs]) : dropzoneJs;
},
treeForStyles(styleTree) {
var dropzoneCss = new Funnel(
path.join(this.project.root, 'node_modules', 'dropzone/dist/min'),
{
files: ['dropzone.min.css'],
destDir: 'app/styles'
}
);
return styleTree ? new MergeTrees([styleTree, dropzoneCss]) : dropzoneCss;
},
included(app) {
let options = app.options.emberCliDropzonejs || { includeDropzoneCss: true };
this.import('vendor/dropzone.min.js');
if (options.includeDropzoneCss){
this.import('app/styles/dropzone.min.css');
}
}
};