-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBrocfile.js
67 lines (61 loc) · 1.82 KB
/
Brocfile.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
62
63
64
65
66
67
var env = require('broccoli-env').getEnv(),
mergeTrees = require('broccoli-merge-trees'),
pickFiles = require('broccoli-static-compiler'),
concat = require('broccoli-concat'),
uglifyJs = require('broccoli-uglify-js'),
compileLess = require('broccoli-less-single'),
buildTemplates = require('broccoli-template-builder'),
compileTemplates = require('ember-template-compiler'),
sourceTree = 'lib',
stylesTree = 'lib/styles',
templatesTree = 'lib/templates',
templates,
js,
css,
prodJs,
prodCss;
templates = buildTemplates(templatesTree, {
extensions: ['hbs'],
outputFile: 'templates.js',
namespace: 'Ember.TEMPLATES',
compile: function(string) {
return 'Ember.Handlebars.template(' + compileTemplates.precompile(string) + ')';
}
});
js = concat(mergeTrees([templates, sourceTree]), {
inputFiles: [
'components/**/*.js',
'views/**/*.js',
'templates-top.js',
'templates.js',
'templates-bottom.js',
'main.js'
],
outputFile: '/ember-spin-box.js'
});
css = compileLess(
[stylesTree],
'ember-spin-box.less',
'ember-spin-box.css'
);
//create minified versions for production
if(env === 'production') {
prodJs = uglifyJs(concat(mergeTrees([templates, sourceTree]), {
inputFiles: [
'components/**/*.js',
'views/**/*.js',
'templates-top.js',
'templates.js',
'templates-bottom.js',
'main.js'
],
outputFile: '/ember-spin-box.min.js'
}));
prodCss = compileLess(
[stylesTree],
'ember-spin-box.less',
'ember-spin-box.min.css',
{cleancss: true}
);
}
module.exports = mergeTrees(env === 'production' ? [templates, prodJs, prodCss, js, css] : [templates, js, css]);