Striving to preserve the existing CSS in the codebase.
.my-new-class {
.existing-class {
...implementing new styles
}
}
.existing-class {
...maintaining old styles
}
I attempted a technique that I know won't work and understand why:
.existing-class {
:not(.my-new-class) & {
...keeping old styles
}
}
Yet, I'm struggling to determine if there's a feasible way to achieve my goal.
Essentially, I want styles to only be applied if a certain element does not have a parent (anywhere in the tree) with a specific class...or perhaps someone can suggest a better approach?
Appreciate it SO!