-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add watch support for stylesheets in packages #8380
Conversation
@@ -24,7 +24,7 @@ const exists = ( filename ) => { | |||
|
|||
// Exclude deceitful source-like files, such as editor swap files. | |||
const isSourceFile = ( filename ) => { | |||
return /.\.js$/.test( filename ); | |||
return /.\.(js|scss)$/.test( filename ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we'd need some kind of rule excluding the components package scss from being watched, since that will end up being watched by both webpack and this script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine :) it will generate a new CSS for the package but not use it in the webpack build.
b25c9b3
to
8780532
Compare
8780532
to
cd33c9e
Compare
accumulator.jsFiles.add( filePath ); | ||
} else if ( isScssFile( filePath ) ) { | ||
const pkgName = getPackageName( filePath ); | ||
const pkgPath = path.resolve( PACKAGES_DIR, pkgName ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In another PR #8287 I have the use-case for multiple SASS entry points (multiple CSS outputs) per package. Do you have some ideas on how this would play together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simplest way I can think of is to add some kind of config, potentially as a custom property to the package.json that could be picked up by the build scripts:
{
scssEntryPoints: [
'style.scss',
'some/other/style.scss'
],
}
Either that or some kind of naming convention e.g. styles.main.scss
.
I think the config idea is safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Description
closes #8343
Scss files in packages are not rebuilt while running
npm run dev
. This PR add watch support for scss files in packages.How has this been tested?
npm run dev
was active and observed that the changes were then visible in the browser after reloading the page.npm run dev
was active and observed no adverse side-effectsnpm run build
and observed no adverse side-effectsTypes of changes
Checklist: