Skip to content

Commit 1847819

Browse files
devversionmmalerba
authored andcommitted
build: scss changes not live-reloading (#4870)
* Sometimes the theme SCSS changes are not being reflected in the browser. This is because the demo-app theme is built from the SCSS mixins and those aren't rebuilt whenever CSS changes inside of Material.
1 parent a681438 commit 1847819

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

tools/gulp/tasks/development.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ task(':watch:devapp', () => {
2525
watch(join(appDir, '**/*.ts'), [':build:devapp:ts', triggerLivereload]);
2626
watch(join(appDir, '**/*.scss'), [':build:devapp:scss', triggerLivereload]);
2727
watch(join(appDir, '**/*.html'), [':build:devapp:assets', triggerLivereload]);
28+
29+
// The themes for the demo-app are built by the demo-app using the SCSS mixins from Material.
30+
// Therefore when the CSS files have been changed the SCSS mixins have been refreshed and
31+
// copied over. Rebuilt the theme CSS using the updated SCSS mixins.
32+
watch(join(DIST_MATERIAL, '**/*.css'), [':build:devapp:scss', triggerLivereload]);
2833
});
2934

3035
/** Path to the demo-app tsconfig file. */

tools/gulp/util/task_helpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as fs from 'fs';
33
import * as gulp from 'gulp';
44
import * as path from 'path';
55
import {PROJECT_ROOT} from '../build-config';
6+
import {yellow} from 'chalk';
67

78
/* Those imports lack typings. */
89
const gulpClean = require('gulp-clean');
@@ -177,7 +178,8 @@ export function serverTask(packagePath: string, livereload = true) {
177178

178179
/** Triggers a reload when livereload is enabled and a gulp-connect server is running. */
179180
export function triggerLivereload() {
180-
gulp.src('dist').pipe(gulpConnect.reload());
181+
console.log(yellow('Server: Changes were detected and a livereload was triggered.'));
182+
return gulp.src('dist').pipe(gulpConnect.reload());
181183
}
182184

183185

0 commit comments

Comments
 (0)