Mixins with Pseudo Elements Incorrectly Namespaced
See original GitHub issueThis SCSS:
@mixin do-a-thing-with-pseudo-elements() {
position: relative;
&::before {
content: '';
// whatever else in here
}
}
.some-class {
@include do-a-thing-with-pseudo-elements();
}
… produces this CSS:
.___namespace_1234 .some-class {
position: relative;
}
.___namespace_1234 .some-class ___namespace_1234::before {
content: '';
// whatever else in here
}
… but should produce:
.___namespace_1234 .some-class {
position: relative;
}
.___namespace_1234 .some-class::before {
content: '';
// whatever else in here
}
cc/ @oligriffiths
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Pseudo Namespacing · Issue #440 · sass/sass - GitHub
Now I've written a mixin that targets certain contexts -- media queries, namespace classes on the root element, etc. @mixin contextify($media-query ...
Read more >Can a CSS pseudo-class be namespaced? - Stack Overflow
1 Answer 1 ... Namespaces, as part of the document language, do not apply directly to pseudo-classes or pseudo-elements, as they're defined in...
Read more >Less.js Mixins Namespaces - GeeksforGeeks
Less.js Mixins Namespaces helps to stack up several ids or classes to mixin properties inside a more complex selector.
Read more >Enter Sass namespacing - Joseph Rex
To solve maintainance problem in CSS we've seen OOCSS, RSCSS, SMACSS, and BEM. With BEM being the most adopted, we opt-in to create...
Read more >Add your own LESS namespace when mixins collections have ...
It's nice as long, as your own mixins' names don't collide with names in a chosen mixins collection.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@webark probably the best temporary fix. Or use something like
& {}
and just wrap everything inside it.@davearel hmm… That one is tricky. We namespace before we preprocess the style files. In your case, that would be somewhere you’d have to preprocess it before adding the namespaces, which opens up a whole other can of worms. I’d say, giving you access to some kine of
:--component
css property that refers to the component would be better. But maybe not.