-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Scoped CSS specificity problem #9801
Comments
Have you tried CSS Modules? |
@sodatea CSS Modules in Vue have an inferior developer experience since they require you do use this syntax: |
I think that's a design tradeoff. |
What other css libraries? The only classes I find myself using that are supposed to take precedence are utility classes and they usually have an important to make sure they override things. If using something like tailwind, you want your scoped CSS to have higher specificity. I guess an option to customize could make sense but this should go in vue-loader |
@sodatea not if the user is aware of the way it works and opted in into the behaviour. This should be an option. @posva You wrote 2 things which contradict. Tailwind is made of utility classes and it has an option to enable The reason you want to avoid enabling Forwarding to vue-loader. |
@sodatea also the example you gave could be used to make the opposite argument. Hashed classnames would prevent elements from being accidentally targeted by unscoped css. |
Vue Loader’s scoped styles implementation works not only for class selectors. Scoped styles allow any selector so generating hashed class names is not enough. |
@Justineo That is a good point, no feature parity. At the same time I have no interest in that feature whatsoever. Can you think of an example where that would actually be a good practice? |
What problem does this feature solve?
Vue achieves scoped css by combining classnames with randomly generated attributes. This increases the specificity of the selectors, making it hard to combine with other CSS libraries.
What does the proposed API look like?
This is a feature request for scoped css through classnames with a hash, without using attribute selectors.
.my-class-j04ckg578h
There should be a way to configure this option on a project level
The text was updated successfully, but these errors were encountered: