-
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
Move to Dart Sass compiler #25628
Move to Dart Sass compiler #25628
Conversation
@yscik, thank you for opening this PR. Let's make sure it gets some proper review. I will raise it as a topic in the next weekly WordPress Core JS chat. |
This was brought up in the weekly WordPress Core JS chat (signup needed) and in general there's no opposition to this change. Will still need an approval from a review. |
@@ -0,0 +1,4 @@ | |||
diff --git a/node_modules/react-dates/lib/css/_datepicker.css b/node_modules/react-dates/lib/css/_datepicker.scss |
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 was wondering if there is a better way to fix the issue with react-dates
. Would it be possible to whitelist somewhere in the webpack config instead?
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.
If I'm understanding the build process correctly, the packages are built outside of webpack with a direct call to sass.render, so webpack's loader config is not used here. Haven't found a way to configure this in Dart-Sass, the syntax is determined based on file extension.
Another approach that seems to work is creating a symlink in the date-time
component:
_datepicker.scss
-> ../../../../node_modules/react-dates/lib/css/_datepicker.css
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.
@import "node_modules/react-dates/lib/css/_datepicker"; |
would it work if the extension was explicitly provided there?
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.
If it's _datepicker.scss
, it won't find the file, if it's _datepicker.css
, the issue remains.
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.
This issue still exists in the latest version:
https://unpkg.com/browse/[email protected]/lib/css/_datepicker.css
Maybe, we should simply copy this file (in the version that Gutenberg uses) to the component's folder and import the local version :)
2693f73
to
3804b0c
Compare
3804b0c
to
bd38117
Compare
node-sass is now officially deprecated so that's one more reason to go through with this 👍 |
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.
Let's move forward with this one and figure out what to do about react-dates
CSS file separately.
Congratulations on your first merged pull request, @yscik! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
Opened #26534 with a proposal to copy SCSS file from |
This PR seems to be breaking some colors on mobile: I noticed that after merging this PR, the
We would expect that |
Looks like it's caused by this That pretty much breaks the whole concept of being able to specify a It could be pretty tricky to work around this limitation. Might be possible to add another preprocessing step for resolving the URLs in import statements before passing the content over to the Sass renderer? For the specific case of the |
Fixes #22729
Description
Replaces
node-sass
withsass
(Dart Sass) as the SASS compiler implementation. — This is a drop-in replacement with the same API, but without having to compile native C bindings.Adds a patch for
react-dates
, renaming it's_datepicker.css
file to thescss
extensiondarken()
function calls, which fails Dart Sass's CSS validation, as it's a Sass functionHow has this been tested?
Comparing the output of the compiled CSS files, there are only stylistic differences:
Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
My code follows the accessibility standards.My code has proper inline documentation.I've updated all React Native files affected by any refactorings/renamings in this PR.