From 3249c27e34885a7ea738337bbb5fd3286fdc9aa9 Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Thu, 28 Jun 2018 19:39:01 -0400 Subject: [PATCH] Add support for multiple tasks on file change --- gulpfile.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 425896a..ae63c80 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -30,9 +30,9 @@ const TWIG_OUT_DIR = "spectabular/twig/"; //Map the various directories to the gulp tasks const WATCH_MAPPINGS = { - [TS_SRC_DIR]: "typescript", - [SASS_SRC_DIR]: "sass", - [TWIG_SRC_DIR]: "twig" + [TS_SRC_DIR]: ["typescript-lint", "typescript"], + [SASS_SRC_DIR]: ["sass"], + [TWIG_SRC_DIR]: ["twig"], }; let isProdBuild = yargs.argv.hasOwnProperty("prod"); @@ -53,11 +53,11 @@ gulp.task("clean", () => { gulp.task("watch", () => { Object.keys(WATCH_MAPPINGS).forEach((dir) => { let globbedPath = path.join(dir, "*"); - let taskName = WATCH_MAPPINGS[dir]; - let watchTask = gulp.watch(globbedPath, [taskName]); + let tasks = WATCH_MAPPINGS[dir]; + let watchTask = gulp.watch(globbedPath, tasks); watchTask.on("change", (file) => { let relativePath = path.relative(__dirname, file.path); - log(`[${chalk.blue(taskName)}] Change detected: ${chalk.green(relativePath)}`); + log(`[${chalk.blue(tasks.join(", "))}] Change detected: ${chalk.green(relativePath)}`); }); }); });