-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuse.js
More file actions
78 lines (72 loc) · 1.63 KB
/
fuse.js
File metadata and controls
78 lines (72 loc) · 1.63 KB
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
68
69
70
71
72
73
74
75
76
77
78
const {
FuseBox,
Sparky,
WebIndexPlugin,
SVGPlugin,
CSSPlugin,
QuantumPlugin
} = require("fuse-box");
const NgTemplatePlugin = require("fuse-box-ng-template-plugin");
const { src, task, watch, context, fuse } = require("fuse-box/sparky");
context(
class {
getConfig() {
return FuseBox.init({
homeDir: "src",
output: "dist/$name.js",
target: "browser@es5",
hash: this.isProduction,
useTypescriptCompiler: true,
sourceMaps: true,
info: true,
debug: true,
shim: {
angular: {
source: "node_modules/angular/angular.js",
exports: "angular"
}
},
plugins: [
NgTemplatePlugin(),
CSSPlugin(),
WebIndexPlugin({
template: "src/index.html"
}),
this.isProduction &&
QuantumPlugin({
bakeApiIntoBundle: "app",
uglify: true,
css: true
})
]
});
}
createBundle(fuse) {
const app = fuse.bundle("app");
if (!this.isProduction) {
app.watch();
app.hmr();
}
app.instructions("> index.js");
return app;
}
}
);
task("clean", () =>
src("dist")
.clean("dist")
.exec()
);
task("default", ["clean"], async context => {
const fuse = context.getConfig();
fuse.dev();
context.createBundle(fuse);
await fuse.run();
});
task("dist", ["clean"], async context => {
context.isProduction = true;
const fuse = context.getConfig();
fuse.dev(); // remove it later
context.createBundle(fuse);
await fuse.run();
});