forked from polyconf/15.thankyou
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Brocfile.js
51 lines (41 loc) · 1.2 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
var concat = require('broccoli-concat'),
funnel = require('broccoli-funnel'),
sass = require('broccoli-sass-source-maps'),
rev = require('broccoli-asset-rev'),
merge = require('broccoli-merge-trees');
var babel = require('broccoli-babel-transpiler');
var browserify = require('broccolify');
var cssnano = require('broccoli-cssnano');
var uglify = require('broccoli-uglify-js');
var env = require('broccoli-env').getEnv();
var img = funnel('images', {
destDir: 'assets'
})
var js = babel('javascripts', {});
var bower = 'bower_components'
js = browserify(merge([bower, js]), {
entries: ['./main.js'],
outputFile: 'assets/main.js'
// browserify: {
// debug: true
// }
});
var css = sass(['stylesheets',
'bower_components/bourbon/app/assets/stylesheets',
'bower_components/neat/app/assets/stylesheets',
],
'main.scss',
'assets/styles.css', {});
var html = 'public'
var result;
switch(env) {
case 'development':
result = merge([js, css, img, html]);
break;
case 'production':
css = cssnano(css);
js = uglify(js);
result = rev(merge([js, css, img, html]));
break;
}
module.exports = result;