madeleineostoja / rucksack

A little bag of CSS superpowers, built on PostCSS

Home Page:https://www.rucksackcss.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto pesudo content fallback

mikestreety opened this issue · comments

Would love to see an extension which adds missing

content: '';

To :before/:after pseudo elements. It is always needed and unless preset, should add it.

Yet to find a post-css (or otherwise) plugin that does this.

commented

I recall seeing a postcss plugin out in the wild that does this, but can’t seem to find it atm. In any case, it would be simple to do, just not sure it fits in Rucksack’s purview. I’ll leave this issue open for now though and see if anyone else would like to chime in.

Yeah, there is this one: https://github.com/omgovich/postcss-pseudo-elements-content

But you have to put -c which, if you can remember/be bothered to add the extra characters, you can remember to add content: ''; 😄

commented

Thinking about this a bit more, and I really can't see how it could fit into Rucksack. It's not a fallback or a replacement, and it's not a new feature. Would make a neat standalone plugin, though I don't have time to build it personally. It'd be pretty easy to do, might be a good way to learn PostCSS if you're keen ;-)

Thanks @seaneking - makes sense.

For anyone stumbling across this issue - I have started development of such a plugin:

https://github.com/liquidlight/postcss-pseudo-content-insert

At time of writing, it's still very much in beta, but should be prod ready soon!