Skip to content

fix: fix watch for child theme CSS#2640

Merged
laurelfulford merged 1 commit intotrunkfrom
fix/css-watch
Feb 26, 2026
Merged

fix: fix watch for child theme CSS#2640
laurelfulford merged 1 commit intotrunkfrom
fix/css-watch

Conversation

@laurelfulford
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

This PR makes sure the child theme SCSS is updated when running npm run watch, not just npm run build.

How to test the changes in this Pull Request:

  1. Run npm run watch.
  2. Make an obvious change in one of the child theme SCSS files (like body { background: red; }
  3. Note the CSS doesn't get applied to the generated CSS
  4. Apply this PR
  5. Repeat steps 1-3 and confirm the CSS changes are generated with watch.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@laurelfulford laurelfulford requested a review from a team as a code owner February 24, 2026 19:53
@laurelfulford laurelfulford added the [Status] Needs Review The issue or pull request needs to be reviewed label Feb 24, 2026
@laurelfulford laurelfulford requested review from Copilot and removed request for a team February 24, 2026 19:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Feb 26, 2026
@laurelfulford
Copy link
Contributor Author

Thanks @miguelpeixe! 🙌

@laurelfulford laurelfulford merged commit 88d50af into trunk Feb 26, 2026
11 checks passed
@laurelfulford laurelfulford deleted the fix/css-watch branch February 26, 2026 18:45
@github-actions
Copy link

Hey @laurelfulford, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

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! ❤️

matticbot pushed a commit that referenced this pull request Mar 5, 2026
# [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))
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🎉 This PR is included in version 2.19.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @alpha [Status] Approved The pull request has been reviewed and is ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants