Skip to content

Instantly share code, notes, and snippets.

@dragosbulugean
Created April 29, 2017 17:20
Show Gist options
  • Save dragosbulugean/12dad2da0b69a916c42cfa6fa7ac22aa to your computer and use it in GitHub Desktop.
Save dragosbulugean/12dad2da0b69a916c42cfa6fa7ac22aa to your computer and use it in GitHub Desktop.
const {
FuseBox, SassPlugin,
CSSPlugin, TypeScriptHelpers,
JSONPlugin, HTMLPlugin, SVGPlugin,
CSSResourcePlugin, Sparky,
} = require("fuse-box")
const homeDir = "./"
Sparky.task("clean", () => {
return Sparky.src("build/*")
.clean("build")
})
Sparky.task("copy-html", () => {
return Sparky.src("web/static/index.html")
.dest("build/app/$name")
})
Sparky.task("build", () => {
const fuse = FuseBox.init({
homeDir,
output: "build/$name.js",
sourceMaps: true,
log: true,
debug: false,
plugins: [
[
SassPlugin({ importer: true }),
CSSPlugin({ group: "styles.css" })
],
TypeScriptHelpers(),
JSONPlugin(),
SVGPlugin(),
HTMLPlugin({ useDefault: false }),
]
})
fuse.dev({
port: 2999,
httpServer: false
})
//api
fuse
.bundle("api/api")
.watch("api/**") //bugs up atm
.instructions(">[api/api.ts]")
.completed(proc => proc.start())
//app vendor
// fuse
// .bundle("app/vendor")
// .instructions(`~ web / app.tsx`);
//app
fuse
.bundle("app/app")
.watch("web/**")
.hmr()
.instructions(">web/app.tsx")
return fuse.run()
})
Sparky.task("dev", ["clean", "copy-html", "build"], () => { })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment