-
Notifications
You must be signed in to change notification settings - Fork 357
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
Using multiple "@use ... with()" with different config on same library #1291
Comments
@use ... with()
with different config@use ... with()
with different config
@use ... with()
with different config@use ... with()
with different config
@use ... with()
with different config
No, this is not possible. One of the goals of the module system is to ensure that each module is only ever loaded once. If you wish to load the same bit of code multiple times with different options, you should use mixins instead. |
Hi @jathak , Work good with linear dependencies tree, but what happen if more dpendencies we need use same |
Hi @jathak 😃 Any idea about my last question? Thank you by advance! |
We generally recommend using |
Hi @jathak, So on my example, the top level is each sub-library or the only way is use config mixins everywhere? The Maybe we need better official examples to how use each cases, because I'm lost when errors comes. :( |
Yes, using mixins is the best way to go here. I've filed sass/sass-site#604 to improve our documentation here and add some examples of how to adapt code using |
Right, thank you @jathak ! |
Hi @jathak Now the next problem I see is that the config mixin is not scoped in the Is this the right behavior? If so, we need to understand that all code that is not overridden must be called before any config mixin call. In this case, the code architecture can come very complicated to prevent any unvolunteer override. |
In this case, you probably want to avoid any sort of global state and just have your entire configuration passed in a variable to a main mixin, which then calls any other mixins necessary with that configuration (rather than setting global variables in your main mixin and then reading it in the other mixins). |
Hi,
Is a way to call twice the same library with
@use ... with()
but with completely different config?Example:
The text was updated successfully, but these errors were encountered: