-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
35 lines (28 loc) · 1.28 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
const { watch } = require('gulp');
const { exec } = require('child_process');
const fs = require('fs');
const path = require('path');
function textures(file) {
exec(`node dist/tools/compileTextures.js "${file}"`, function (err, stdout, stderr) {
const outPath = path.dirname(file);
const outName = path.basename(file, ".sdf");
fs.writeFile(`${outPath}/${outName}.ts`, stdout, () => { });
});
}
function shaders(file) {
exec(`tools/glsl/minify_glsl.sh src/core/renderer/shaders src/core/renderer/shaders/shaders.ts`, function (err, stdout, stderr) {
});
}
function maps(file) {
exec(`node dist/tools/compileMap.js "${file}"`, function (err, stdout, stderr) {
const outPath = path.dirname(file);
const outName = path.basename(file, ".map");
fs.writeFile(`${outPath}/${outName}.ts`, `export const ${outName} = "${stdout.trim()}";\n`, () => { });
});
}
exports.default = () => {
watch('src/assets/maps/*.map', { ignoreInitial: false }).on('change', maps);
watch('src/assets/*.sdf', { ignoreInitial: false }).on('change', textures);
watch('src/core/renderer/shaders/*.vert', { ignoreInitial: false }).on('change', shaders);
watch('src/core/renderer/shaders/*.frag', { ignoreInitial: false }).on('change', shaders);
}