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
Question: why does external compose all the classes into a selector? #727
Comments
I haven't run into any downsides of the current approach, your suspicion is correct in that including all of the dependencies feels more correct and unsurprising to me. They could change out from underneath you, yes, but that's why Is the current behavior causing issues for you? |
It's not causing issues in the sense something is broken, but it is leading to confusing css, and more bytes. Specifically we use something like tailwindcss where you can have a lot of classes composed in: .foo {
composes: pt-5 pb-6 mx-6 bg-red leading-wide from global;
} you end up with a long selector that isn't necessary. I also see the other side of this which is that |
Certainly seems like you could run some experiments with changing that by modifying this to only take the... final element from modular-css/packages/processor/plugins/externals.js Lines 25 to 27 in e9de291
|
yup will do some research, wanted to make sure i had all the context first 👍 |
@jquense Any updates on this? |
no real updates. We've tried both approaches and they seem to work equally well with one producing less css so that's nice. Data is super anecdotal tho, I don't know if it'd break other people or lead to some intractable case. I would consider it tho, smaller, less complex output is a nice win, not sure tho if there is a hidden cost i'm not seeing |
I'm open to a PR changing this behavior :) |
Just a general question about the original rationale for having
:external
compose all the clases the references composes and not just the class matching the identifier:Produces:
instead of
The current approach it seems maybe more "correct" somehow, but also leads to selectors whose specificity is hard to reason about (and can change indirectly). Wondering if there were specific practical considerations or if you've seen benefits vs downsides to this approach?
The text was updated successfully, but these errors were encountered: