-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpFile.js
56 lines (48 loc) · 1.2 KB
/
gulpFile.js
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
var gulp = require("gulp");
var source = require("vinyl-source-stream");
var buffer = require("vinyl-buffer");
var cp = require("child_process");
var browserify = require("browserify");
var util = require("gulp-util");
var paths = {
public: "./public",
dist: "./dist",
mainElm: "./ui-src/Main.elm",
elm: "./ui-src/**/*.elm",
mainJs: "./ui-src/app.js",
js: "./ui-src/*.js",
electron: "./main.js",
};
gulp.task("js", function () {
return browserify(paths.mainJs)
.bundle()
.pipe(source("app.js"))
.pipe(buffer())
.pipe(gulp.dest(paths.public));
});
gulp.task("elm", function () {
util.log(util.colors.cyan("Elm"), "starting");
cp.spawn("elm", [
"make",
paths.mainElm,
// "--optimize",
"--output",
paths.public + "/elm.js",
], {
stdio: 'inherit'
}).on("close", function (code) {
util.log(util.colors.cyan("Elm"), "closed");
});
});
gulp.task("electron", function () {
cp.spawn("electron", [
paths.electron
], {
stdio: 'inherit'
}).on("close", function (code) {
util.log(util.colors.cyan("Electron"), "closed");
});
});
gulp.watch(paths.elm, ["elm"]);
gulp.watch(paths.js, ["js"]);
gulp.task("default", ["elm", "js"]);