-
-
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
Recessive CSS rules #6859
Comments
Would would this compile to in the output CSS for a component? We're limited by what's actually supported in CSS, and there's nothing like |
It exists, and it's called the |
Does The question then is whether making that change would be considered breaking. Probably technically, but I'm also having a hard time imagining anyone depending on the current |
@TheOnlyTails made an excellent point here!
Using I assume Svelte's policy on CSS is that anything inside the style tag must parse as valid CSS, i.e. we can't define any new keyword or syntax? |
Assuming the CSS scoping system works like I think it does, if you insert each selector into the |
I just tried this out and what's odd is the REPL and the latest SvelteKit In the REPL, the local styles even wrapped in |
If this is changed, it could be regarded as a breaking change since people may rely on this, consciously or not. |
If you want a verbose workaround, you can avoid the use of .foo.foo {
color: red;
} I'm not saying that this is a good alternative, just that it doesn't use |
So how about a having a new style tag <style context="fallback">
color: red
</style> similar to how there are two types of script tags ( |
I'm not sure it is related, but I currently face an issue when trying to integrate daisyUI in my Svelte application. daisyUI uses this syntax: |
@dsebastien See #6434. |
This comment has been minimized.
This comment has been minimized.
@dummdidumm @Conduitry Is a solution to this still on the table for Svelte v5? E.g. by changing the way |
Svelte 5 uses |
Describe the problem
Every CSS rule applied internally to a component that you want to override from the outside with global CSS requires the
!important
keyword. See REPL.Describe the proposed solution
Recessive CSS rules, i.e. rules with lowest possible specificity no matter with what selector they were set with inside the component.
Not sure what's the word to use here. Just using recessive in the style of genes where the dominant allele is the one expressed in the phenotype while recessive alleles are masked.
Such rules could be placed inside a special scope (similar to
:root {}
) or perhaps applied through a class with a special keyword so the svelte compiler knows to apply these rules with low specificity.Alternatives considered
Creating CSS variables for every CSS rule in a component gets old fast. Plus changing these CSS props is quite verbose. E.g. to specify just four colors:
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: