-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathfuse.ts
44 lines (41 loc) · 1.05 KB
/
fuse.ts
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
import { fusebox, pluginAngular, pluginSass, sparky } from "fuse-box";
class Context {
isProduction;
runServer;
getConfig = () =>
fusebox({
target: "browser",
entry: "src/entry.ts",
modules: ["./node_modules"],
webIndex: {
publicPath: ".",
template: "src/index.html"
},
cache: { enabled: true, FTL: true, root: "./.cache" },
watch: true,
devServer: this.runServer,
plugins: [
pluginAngular("*.component.ts"),
pluginSass({ asText: true, useDefault: false })
]
});
}
const { task, rm, exec } = sparky<Context>(Context);
task("default", async ctx => {
ctx.runServer = true;
const fuse = ctx.getConfig();
await fuse.runDev();
});
task("preview", async ctx => {
rm("./dist");
ctx.runServer = true;
ctx.isProduction = true;
const fuse = ctx.getConfig();
await fuse.runProd({ uglify: false });
});
task("dist", async ctx => {
ctx.runServer = false;
ctx.isProduction = true;
const fuse = ctx.getConfig();
await fuse.runProd({ uglify: false });
});