-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
Fix Sass compilation breaking change in v5.3 #39380
Fix Sass compilation breaking change in v5.3 #39380
Conversation
f25b1fd
to
570cd24
Compare
I have confirmed that this does in-fact correct the build-breaking issue, and does not have any affect on |
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 small enough to get through as is since this behavior was introduced in v5.3 and we don't recommend overriding variables by using !default
flag (couldn't find any workaround that doesn't break anything that was working before). However, one thing that doesn't work anymore is defining Sass variables for dark mode with !default
flag between variables
and variables-dark
:
@import "variables";
$primary-text-emphasis-dark: #af6 !default; // Or a file containing this kind of variables
@import "variables-dark";
Despite of this small use case, I'd be fine to go with it.
A quick question, what the tests (@include describe(...)
) stand for in this context ? If I remove the tests and keep the imports, I get the exact same results.
Good catch, I didn't test this use case. However, I agree with you that it's really an edge case that shouldn't happen since it's not really logical to do that.
You're right, I've simplified the test to rely only on imports and renamed it to |
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'm fine with this version 👌
Description
This PR hides a Sass compilation-breaking change happening with the new color modes feature. This fix should be removed in v6 as the breaking change will be tolerated.
This solution has two objectives:
So the idea here is to keep the documentation as is where it is mentioned that the extra import is needed.
However, our _variables.scss will automatically add the extra import if the user has not done it.
It shouldn't be an issue since variables would be just overwritten with the same content, and so the final bundle would remain the same.
To avoid other breaking changes linked to this same issue, a new
scss/tests/mixins/_auto-import-of-variables-dark.test.scss
has been created. I've voluntarily not modified other test files to make this new test independant so it can be removed safely in v6.When reviewing this PR, please try to re-do the manual tests, and don't hesitate to comment on this PR with other use cases I've probably missed, just to be sure to cover everything.
Manuel testing
I've manually tested some use cases based on the following HTML file:
Simple Bootstrap import
Simple Bootstrap import + primary color override
Customized Bootstrap import
Customized Bootstrap import + colors override
Customized Bootstrap import + colors override when
_variables-dark.scss
is importedType of changes
Checklist
npm run lint
)Live previews
Related issues
Closes #39367