forked from hipertracker/react-es7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBrocfile.js
65 lines (56 loc) · 1.84 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
var rimraf = require('rimraf'),
mergeTrees = require('broccoli-merge-trees'),
Funnel = require('broccoli-funnel'),
compileSass = require('broccoli-sass'),
esTranspiler = require('broccoli-6to5-transpiler'),
fastBrowserify = require('broccoli-fast-browserify'),
uglifyJavaScript = require('broccoli-uglify-js'),
gzipFiles = require('broccoli-gzip'),
env = require('broccoli-env').getEnv();
var staticFiles = new Funnel('src', {
files: ['index.html']
});
// build vendor/*
var jqueryFiles = new Funnel('bower_components/jquery/dist', {
include: [
new RegExp(/\.min\.(js|map)$/),
],
destDir: 'vendor/jquery'
}),
semanticUIFiles = new Funnel('bower_components/semantic-ui/dist', {
include: [
new RegExp(/\.min\.(js|css)$/),
new RegExp(/themes/)
],
destDir: 'vendor/semantic-ui'
}),
fontAwesomeFiles = new Funnel('bower_components/font-awesome', {
include: [
new RegExp(/min\.css$/),
new RegExp(/fonts/)
],
destDir: 'vendor/font-awesome'
});
var vendorFiles = mergeTrees([jqueryFiles, semanticUIFiles, fontAwesomeFiles]);
var cssFiles = compileSass(['src'], 'styles/app.scss', 'styles/app.css');
var jsFiles = new Funnel('src', {
exclude: [new RegExp(/__tests__/)],
include: [new RegExp(/\.js$/)]
});
jsFiles = esTranspiler(jsFiles, {experimental: true});
jsFiles = fastBrowserify(jsFiles, {
bundles: {
'index.js': {
entryPoints: ['**/index.js']
}
}
});
if (env === 'production') {
jsFiles = uglifyJavaScript(jsFiles);
jsFiles = gzipFiles(jsFiles, {
extensions: ['js', 'css'],
keepUncompressed: true
});
}
rimraf.sync('./dist');
module.exports = mergeTrees([staticFiles, vendorFiles, jsFiles, cssFiles], {overwrite: false});