Add support for multiple tasks on file change

font-awesome
Nick Krichevsky 2018-06-28 19:39:01 -04:00
parent 4580d8c2fa
commit 3249c27e34
1 changed files with 6 additions and 6 deletions

View File

@ -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)}`);
});
});
});