fix: fix watch for child theme CSS#2640
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where child theme SCSS files were not being watched and recompiled during development when using npm run watch. Previously, only the parent theme's SCSS files were being watched. The fix explicitly adds watch paths for all five child themes (sacha, scott, nelson, katharine, and joseph).
Changes:
- Extended the chokidar watch configuration to include sass directories for all child themes
Comments suppressed due to low confidence (2)
scripts/compile-scss.js:231
- The watch configuration is missing the tribe-events directories that also contain SCSS files. Looking at the SASS_STYLESHEETS array (lines 136-137, 155-156, 169-170, 183-184, 197-198, 211-212), each child theme and the parent theme have tribe-events directories with SCSS files that need to be compiled. These directories should also be watched for changes to ensure their SCSS files are recompiled during development.
chokidar.watch( [
'newspack-theme/sass/**/*.scss',
'newspack-sacha/sass/**/*.scss',
'newspack-scott/sass/**/*.scss',
'newspack-nelson/sass/**/*.scss',
'newspack-katharine/sass/**/*.scss',
'newspack-joseph/sass/**/*.scss',
] ).on( 'change', path => {
scripts/compile-scss.js:231
- The hardcoded list of watch paths creates a maintainability issue. Each time a new child theme is added, developers need to remember to update this watch array. Consider deriving the watch paths from the SASS_STYLESHEETS array or using a configuration constant that defines child themes in one place. This would ensure the watch functionality stays in sync with the build configuration and reduce the chance of missing paths when new child themes are added.
chokidar.watch( [
'newspack-theme/sass/**/*.scss',
'newspack-sacha/sass/**/*.scss',
'newspack-scott/sass/**/*.scss',
'newspack-nelson/sass/**/*.scss',
'newspack-katharine/sass/**/*.scss',
'newspack-joseph/sass/**/*.scss',
] ).on( 'change', path => {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks @miguelpeixe! 🙌 |
|
Hey @laurelfulford, good job getting this PR merged! 🎉 Now, the Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label. If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label. Thank you! ❤️ |
# [2.19.0-alpha.1](v2.18.3...v2.19.0-alpha.1) (2026-03-05) ### Bug Fixes * fix watch for scss build ([#2640](#2640)) ([88d50af](88d50af)) * follow Copilot suggestion to wrap in double quotes and escape same in font names too ([71af6d5](71af6d5)) * force array output to ensure window.newspackFontLoading() doesn't emit unexpected JS objects ([68614c4](68614c4)) * quote font names ([2585e72](2585e72)) * quote font names ([b6ab9f9](b6ab9f9)) * remove unnecessary character class, capture group; suggested by Claude ([5e44728](5e44728)) ### Features * add agents, claude MD and update readme ([#2639](#2639)) ([8920552](8920552))
|
🎉 This PR is included in version 2.19.0-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
This PR makes sure the child theme SCSS is updated when running
npm run watch, not justnpm run build.How to test the changes in this Pull Request:
npm run watch.body { background: red; }watch.Other information: