Closed BeiyanYunyi closed 1 year ago
Thanks so much for highlighting this. Just to clarify, the issue occurs when there are a group of selectors used separated by a comma. I can't believe I missed this.
I've reviewed your changes, and all seem to work fine. I'll pull them and publish the changes to npm. Thanks again!
The minimal reproduction is here.
I was using windicss before. Since I've switched to unocss, I've found that the
flex-gap-polyfill
plugin doesn't work as expected, in a flex container with gaps, elements will have a wrong size.Then I started to make a minimal reproduction of the bug, and found another necessary condition to reproduce the bug: the attributify preset of unocss. To reproduce the bug, we need a element with a
flex
attribute (with any or none prefix). When the related css is packed, the bug will happen.Windicss also has attributify mode, but it won't trigger this bug.
Steps to reproduce
Open
index.html
, see the follow lines and try it:Or run
pnpm build
to see the output indist/assets/index-[hash].css
Reason
Unocss's output is
unocss_output.css
, and windicss's output iswindicss_output.css
. The difference is:https://github.com/gavinmcfarland/flex-gap-polyfill/blob/80b6e87b6a125421a945be73c3081832e7ee8797/src/index.js#L118-L119
It seems like that the
flex-gap-polyfill
plugin doesn't work as expected when there're multiple selectors in the same rule, which causes the bug.