Skip to content

Instantly share code, notes, and snippets.

@gmlnchv
Created January 26, 2018 02:33
Show Gist options
  • Save gmlnchv/afef68616a96289907ac5b9ecdfc0b3a to your computer and use it in GitHub Desktop.
Save gmlnchv/afef68616a96289907ac5b9ecdfc0b3a to your computer and use it in GitHub Desktop.
import {
FuseBox,
QuantumPlugin,
SassPlugin,
CSSPlugin,
Sparky
} from "fuse-box";
let fuse, app, isProduction;
Sparky.task("config", () => {
fuse = new FuseBox({
homeDir: "src",
target: "browser@es6",
hash: false,
sourceMaps: !isProduction,
output: "dist/$name.js",
useTypescriptCompiler: true,
plugins: [
[SassPlugin(), CSSPlugin()],
isProduction &&
QuantumPlugin({
bakeApiIntoBundle: "app",
uglify: true
})
]
});
app = fuse.bundle("app").instructions("> index.js");
});
Sparky.task("default", ["clean", "config"], () => {
fuse.dev({ open: false });
app.watch().hmr();
return fuse.run();
});
Sparky.task("clean", () => Sparky.src("dist").clean("dist/"));
Sparky.task("prod-env", ["clean"], () => {
isProduction = true;
});
Sparky.task("dist", ["prod-env", "config"], () => {
return fuse.run();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment