Skip to content

Commit

Permalink
build: livereload not working for cdk changes (angular#5452)
Browse files Browse the repository at this point in the history
When serving the demo-app the Material package will be watched using the generated `material:watch` task. This does not mean that the `cdk:watch` task will run too because Material depends on the CDK.

With this change, the watch task will now also run the watch tasks of the packages it depends on.
  • Loading branch information
devversion authored and tinayuangao committed Jun 30, 2017
1 parent c9f7f46 commit 9d621c7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/package-tools/gulp/build-tasks-gulp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export function createPackageBuildTasks(packageName: string, requiredPackages: s
// Glob that matches every HTML file in the current package.
const htmlGlob = join(packageRoot, '**/*.html');

// List of watch tasks that need run together with the watch task of the current package.
const dependentWatchTasks = requiredPackages.map(pkgName => `${pkgName}:watch`);

/**
* Main tasks for the package building. Tasks execute the different sub-tasks in the correct
* order.
Expand Down Expand Up @@ -86,7 +89,9 @@ export function createPackageBuildTasks(packageName: string, requiredPackages: s
* Asset tasks. Building SASS files and inlining CSS, HTML files into the ESM output.
*/
task(`${packageName}:assets`, [
`${packageName}:assets:scss`, `${packageName}:assets:copy-styles`, `${packageName}:assets:html`
`${packageName}:assets:scss`,
`${packageName}:assets:copy-styles`,
`${packageName}:assets:html`
]);

task(`${packageName}:assets:scss`, buildScssTask(packageOut, packageRoot, true));
Expand All @@ -102,7 +107,7 @@ export function createPackageBuildTasks(packageName: string, requiredPackages: s
/**
* Watch tasks, that will rebuild the package whenever TS, SCSS, or HTML files change.
*/
task(`${packageName}:watch`, () => {
task(`${packageName}:watch`, dependentWatchTasks, () => {
watch(join(packageRoot, '**/*.+(ts|scss|html)'), [`${packageName}:build`, triggerLivereload]);
});
}

0 comments on commit 9d621c7

Please sign in to comment.