-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpFile.js
52 lines (45 loc) · 1.19 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
const { src, dest, parallel, series, watch } = require('gulp');
const elm = require('gulp-elm');
const fs = require('fs');
const server = require('./server');
const model = {
optimizeElm : false,
server: null
};
function devDestDir(path) {
const root = "./public";
if (typeof path === "undefined") {
return root;
}
return root + "/" + path;
}
function compile_elm() {
return src('src/Main.elm')
.pipe(elm.bundle("elm.js", {
optimize: model.optimizeElm,
elm: "./node_modules/elm/bin/elm"
}))
.pipe(dest(devDestDir()));
}
function compileElmBasic(params) {
return src('src/Main.elm')
.pipe(elm.bundle("elm.js", {
optimize: params.optimize,
elm: "./node_modules/elm/bin/elm"
}))
.pipe(dest(devDestDir()));
}
function compile_js() {
return src("src/app.js").pipe(dest(devDestDir()));
}
exports.dev = function() {
parallel(compile_elm, compile_js)();
watch("src/**/*.elm", compile_elm);
watch("src/app.js", compile_js);
server(6888, console.log);
}
exports.buildProd = function(cb) {
model.optimizeElm = true;
series(compile_elm, compile_js)();
cb();
}