-
Notifications
You must be signed in to change notification settings - Fork 0
/
Brocfile.js
57 lines (44 loc) · 1.24 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
var browserify = require("broccoli-browserify");
var mergeTrees = require("broccoli-merge-trees");
var uglify = require("broccoli-uglify-js");
var funnel = require("broccoli-funnel");
var env = require("broccoli-env").getEnv();
var dev = env === "development";
var sourceCodeTree = funnel("lib", {
srcDir: "/",
destDir: "/lib"
});
if (dev) {
var testTree = funnel("test", {
srcDir: "/",
destDir: "/test"
});
var testIndexTree = funnel("test", {
srcDir: "/",
files: ["test.html"],
destDir: "/"
});
var mochaTree = funnel("node_modules", {
srcDir: "/mocha",
files: ["mocha.js", "mocha.css"],
destDir: "/"
});
var appTree = mergeTrees([sourceCodeTree, testTree]);
var appTree = browserify(appTree, {
entries: ["./test/class_test.js", "./lib/class"],
outputFile: "bundle.js"
});
module.exports = mergeTrees([appTree, testIndexTree, mochaTree]);
} else {
var appTree = browserify(sourceCodeTree, {
entries: ["./lib/class"],
bundle: { standalone: "Class" },
outputFile: "class.js"
});
var minifiedTree = uglify(appTree);
var minifiedTree = funnel(minifiedTree, {
srcDir: "class.js",
destDir: "class.min.js"
});
module.exports = mergeTrees([appTree, minifiedTree]);
}