-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuse.js
More file actions
64 lines (58 loc) · 1.74 KB
/
Copy pathfuse.js
File metadata and controls
64 lines (58 loc) · 1.74 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
const { FuseBox, Sparky, SVGPlugin, CSSPlugin, QuantumPlugin, PostCSSPlugin } = require("fuse-box");
const { src, task, watch, context, fuse } = require("fuse-box/sparky");
const postCSSPlugins = [
require('postcss-nested'),
require('postcss-simple-vars'),
require('postcss-calc'),
require("postcss-cssnext")({
browsers: ["ie >= 11", "last 2 versions"],
}),
]
context(class {
getConfig() {
return FuseBox.init({
homeDir: "src/views",
output: "dist/public/$name.js",
target : "browser@es5",
hash: this.isProduction,
sourceMaps: !this.isProduction,
useTypescriptCompiler : true,
plugins: [
[
PostCSSPlugin(postCSSPlugins),
CSSPlugin({
group: "styles.css"
}),
],
this.isProduction && QuantumPlugin({
bakeApiIntoBundle: "app",
uglify: true,
css : true,
treeshake: true,
})
]
})
}
createBundle(fuse) {
const app = fuse.bundle("app");
if (!this.isProduction) {
app.watch()
app.hmr()
}
app.instructions(">index.tsx");
return app;
}
});
task("clean", () => src("dist/public").clean("dist/public").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();
context.createBundle(fuse);
await fuse.run();
});