-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
42 lines (34 loc) · 964 Bytes
/
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
const gulp = require('gulp');
const watch = require('gulp-watch');
const { spawn } = require('child_process');
let watchPaths = ['src/**/*', 'scripts/**/*'];
gulp.task('watch', function () {
watch(watchPaths, function () {
runScript('generate-schemes.js');
runScript('generate-themes.py');
});
});
function runScript(scriptName) {
let command;
let args;
if (scriptName.endsWith('.py')) {
command = 'python';
args = [`scripts/${scriptName}`];
} else if (scriptName.endsWith('.js')) {
command = 'node';
args = [`scripts/${scriptName}`];
} else {
console.error('Unsupported script type:', scriptName);
return;
}
const process = spawn(command, args);
process.stdout.on('data', (data) => {
console.log(data.toString());
});
process.stderr.on('data', (data) => {
console.error(data.toString());
});
process.on('error', (err) => {
console.error('Failed to start subprocess.', err);
});
}