twind
twind copied to clipboard
refactor: use stylis as prefixer
The PR supersedes #311 and is now targeting the next
branch. And I also port the unit test from the main
branch.
Replace style-vendorizer
with stylis
:
-
stylis
supports more prefixes thanstyle-vendorizer
(see the change of unit tests). -
stylis
is way faster and more efficient (here is howstylis
implemented their prefixer) -
stylis
is used by many popular CSS-in-JS libraries like emotion, linaria and Vercel's styled-jsx
The pull request is marked as a draft:
-
stylis
doesn't support prefixtab-size
yet, https://github.com/thysultan/stylis/pull/288 -
stylis
doesn't support prefixposition:sticky !important
(however it does supportposition:sticky!important
) yet, https://github.com/thysultan/stylis/pull/289
Awesome. Really like to solution. Did you notice any file size changes?
Awesome. Really like to solution. Did you notice any file size changes?
Actually, yes. It seems that stylis
(after tree shaking and minified) is about 500 bytes larger than style-vendorizer
(I have run pnpm run build
then compared the umd size).
I assume it is because stylis supports a wider range of properties and values.
[email protected]
has been released. Mark the PR ready to review.
Thank you for your work. I'm somehow struggling to merge this. Would it be possible to have this as an additional autoprefix preset - maybe @twind/preset-autoprefix-stylis? I really like this solution but I'm hesitant because of the file size increase. Please give me a few more days to think about it.
Closing for now... because I'll rename the next branch to main and this will close this PR. Please re-open if this is still issue for you. In the meantime I've update style-vendorizer. Maybe all issue are solved now.