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
|
const { parallel, series, watch } = require('gulp');
const electron = require('./electron');
const assets = require('./assets');
const scripts = require('./scripts');
function watchMainScripts() {
return watch(['build/src/main/**/*.js'], series(electron.reloadMain));
}
function watchCss() {
return watch(['src/renderer/**/*.css'], series(assets.copyCss, electron.reloadRenderer));
}
function watchConfig() {
return watch(['src/config.json'], series(assets.copyConfig, electron.reloadRenderer));
}
function watchHtml() {
return watch(['src/renderer/index.html'], series(assets.copyHtml, electron.reloadRenderer));
}
function watchStaticAssets() {
return watch(['assets/**'], series(assets.copyStaticAssets, electron.reloadRenderer));
}
watchMainScripts.displayName = 'watch-main-scripts';
watchCss.displayName = 'watch-css';
watchConfig.displayName = 'watch-config';
watchHtml.displayName = 'watch-html';
watchStaticAssets.displayName = 'watch-static-assets';
exports.start = series(
// copy all assets first
assets.copyAll,
// make an incremental script compiler running in watch mode
scripts.makeWatchCompiler(
// set up hotreload, run electron and begin watching filesystem for changes, after the first
// successful build
series(
electron.start,
parallel(watchMainScripts, watchCss, watchConfig, watchHtml, watchStaticAssets),
),
electron.reloadRenderer,
),
);
|