-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 bug with setting theme in compatability mode resulting in a noop #9617
Comments
@tw15egan let me know if you need any more steps to reproduce! @janhassel let me know if I misframed your original issue, I know the wording/example changed a bit in this ticket and wanted to double-check if I was incorrectly assuming it was the same issue as what you were running into. |
@joshblack The issue I ran into was the following: I wanted to import all Carbon styles in g100 theme. I tried these two approaches based on the docs: @use '@carbon/styles';
@use '@carbon/styles/scss/themes';
@use '@carbon/styles/scss/theme' with (
$theme: themes.$g100,
); Error
@use '@carbon/styles/scss/themes';
@use '@carbon/styles/scss/theme' with (
$theme: themes.$g100,
);
@use '@carbon/styles'; Error
|
@janhassel thanks! Side-note: I think you'll have to always use the second form just as a heads up otherwise you'll get the error where a module has been used before it's being configured. |
@janhassel I think what you'll need to end up doing is: @use '@carbon/styles/scss/compat/themes' as compat;
@use '@carbon/styles/scss/themes';
@use '@carbon/styles/scss/theme' with (
// Make sure new tokens are in the correct theme (by default they are themes.$white)
$fallback: themes.$g100,
// Add the compat tokens to the theme
$theme: compat.$g100,
);
@use '@carbon/styles'; This should be temporary as our codebase is still internally using tokens from v10. The error you ran into basically happens when a v11 theme is provided but the component is looking for a v10 token. Let me know if this works 👀 |
After #9677 you should be able to write what you wrote in example 2 so you can wait for that too! |
@joshblack Your interim solutions seems to work great. As soon as the PR is merged and included in a release, I'll definitely try it out and let you know as it would be a lot cleaner. |
@joshblack @sstrubberg Sadly it seems that even with |
@janhassel I think until we update the code to use the new tokens we'll run into this issue since the theme is looking for tokens that don't exist. I'll make sure we will go and update them in the next release though so that you can configure the theme as expected 👍 |
This issue was originally reported by @janhassel where the compat theme was not able to have its value changed.
Code to reproduce:
Here, we expected the tokens to use values from the g90 theme but they use the value from the white theme instead. It seems like this is related to the issue Jan reported in that the theme would not allow you to correctly retrieve
interactive-01
as a token because the themes were not being mergedThe text was updated successfully, but these errors were encountered: