-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (42 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
const gulp = require("gulp");
const { series, parallel, src, dest, watch } = require("gulp");
const exec = require('child_process').exec;
const sass = require('gulp-sass')(require('sass'));
function transferStatic(cb) {
return src("src/static/*").pipe(dest("bin/"));
cb();
}
function buildStyles(cb) {
exec('sass src/scss/style.scss bin/style.css', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
};
function copyAssets(cb) {
return src("src/assets/*").pipe(dest("bin/assets/"));
cb();
}
function compileCode(cb) {
exec('haxe build.hxml', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
}
function compileStory(cb) {
exec('python3 compiler/compiler.py src/story _tempstory.json', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
}
exports.watchSite = function () {
watch("src/static/*", transferStatic);
}
let transferAll = parallel(transferStatic, buildStyles, copyAssets);
let compileGame = series(compileStory, compileCode);
let makeAll = parallel(compileGame, transferAll);
exports.default = makeAll;
exports.compile = compileGame;
exports.update = transferAll;