-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
:deep
selector doesn't work properly with SASS nested parent selector
#6605
Comments
After a round of searching, there is really no good solution, unless you use less |
Yes, this is a problem since third party components have callback functions that allow users to add custom CSS classes into their components but the problem is that the inserted classes lack scoping therefore they never get "selected" by the scoped CSS when using SCSS/SASS and the |
I found a workaround but it involves using an additional class as an anchor for the Using the above example from @arrudaje: .element {
&__block {
color: #aa8855;
}
} You can add a dummy class (eg :deep(.parent) {
.element {
&__block {
color: #aa8855;
}
}
} This will produce the following CSS output .parent .element__block {
color: ##aa8855;
} Obviously, the drawback of this approach is that it introduces the need for an additional class which increases the size of the CSS generated as well as increasing the specificity of the CSS rule. To use these classes you also need to use a new parent element or use an existing parent element and add the |
I don't think this is a vue bug. .hello {
:deep(&__subtitle) {
color: #aa8855;
}
} compiled to .hello :deep(&__subtitle) {
color: #aa8855;
} instead of :deep(.hello__subtitle) {
color: #aa8855;
} see scss playground this is difference from less, see less playground |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Vue version
v3.2.38
Link to minimal reproduction
https://codesandbox.io/s/sad-alex-uj6q2u?file=/src/components/HelloWorld.vue
Steps to reproduce
:deep
selector:What is expected?
The style is applied correctly to the deep dynamic element
What is actually happening?
The style is not applied. This is because the
:deep
selector takes precedence to the SASS compilation phase, so the final CSS output to the browser is likeinstead of
.element__block { ... }
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: