Created
November 24, 2017 12:41
-
-
Save ccapndave/79b6362c3b698814272d44527e927f81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { FuseBox, PostCSSPlugin, LESSPlugin, CSSPlugin, Sparky } = require("fuse-box"); | |
const { ElmPlugin } = require("./ElmPluginClass"); | |
const path = require("path"); | |
const homeDir = "app"; | |
const destDir = "dist"; | |
Sparky.task("build", () => { | |
const fuse = FuseBox.init({ | |
homeDir, | |
output: `${destDir}/$name.js`, | |
plugins: [ | |
// Elm | |
ElmPlugin(), | |
// Less chain | |
[ | |
LESSPlugin({ paths: [path.resolve(__dirname, "node_modules")] }), | |
PostCSSPlugin([require("autoprefixer")({ map: true, browsers: ['last 2 version'] })]), | |
CSSPlugin() | |
], | |
], | |
debug: true | |
}); | |
fuse.dev({ httpServer: false }); | |
// Bundle the application | |
fuse.bundle("app") | |
.target("browser") | |
.instructions("> js/app.ts") | |
.watch("js/**/*") | |
.watch("elm/src/**/*") | |
.watch("style/**/*"); | |
// Run the development server | |
fuse.bundle("server") | |
.target("node") | |
.instructions("> [server.js]") | |
.watch("server.js") | |
.completed(proc => { | |
proc.kill(); | |
proc.start(); | |
}); | |
fuse.run(); | |
}); | |
Sparky.task("copy:assets", () => Sparky.watch("./assets/**/*", { base: homeDir }).dest(`./${destDir}`)); | |
Sparky.task("copy:vendor", () => Sparky.watch("./vendor/**/*", { base: homeDir }).dest(`./${destDir}`)); | |
Sparky.task("copy:index", () => Sparky.watch("./index.html", { base: homeDir }).dest(`./${destDir}`)); | |
Sparky.task("copy", ["copy:assets", "copy:vendor", "copy:index"], () => {}); | |
Sparky.task("default", ["copy", "build"], () => {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment