From 61627c2a6aa04af5f37490ed98a9a3989ceceef6 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 11 May 2021 18:32:34 +0000 Subject: [PATCH] Refactor the build-task --- gulpfile.ts | 56 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/gulpfile.ts b/gulpfile.ts index 01fa4c1..3b3874a 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -194,31 +194,41 @@ function BrowserSync(filePath?: string): TaskFunction */ export async function Build(): Promise { - if (settings.Watch) - { - log.info(watchStartMessage); + return new Promise( + (resolve, reject) => + { + if (settings.Watch) + { + log.info(watchStartMessage); - syncer.init({ - open: false, - proxy: "http://localhost", - port: 3000, - ui: { - port: 3001 - }, - ghostMode: false, - online: false + syncer.init({ + open: false, + proxy: "http://localhost", + port: 3000, + ui: { + port: 3001 + }, + ghostMode: false, + online: false + }); + + gulp.watch(settings.ThemeSource("**"), { usePolling: true }, gulp.series(Theme, BrowserSync("*.css"))); + gulp.watch(settings.TemplateSource("**"), { usePolling: true }, gulp.series(Templates, BrowserSync())); + } + + gulp.parallel(Library, Theme, Templates)( + (error) => + { + if (error) + { + reject(error); + } + else + { + resolve(); + } + }); }); - - gulp.watch(settings.ThemeSource("**"), { usePolling: true }, gulp.series(Theme, BrowserSync("*.css"))); - gulp.watch(settings.TemplateSource("**"), { usePolling: true }, gulp.series(Templates, BrowserSync())); - } - - await Promise.all( - [ - Library(), - Theme(), - Templates() - ]); } /**