twind icon indicating copy to clipboard operation
twind copied to clipboard

refactor: use stylis as prefixer

Open SukkaW opened this issue 2 years ago • 4 comments

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:


The pull request is marked as a draft:

  • stylis doesn't support prefix tab-size yet, https://github.com/thysultan/stylis/pull/288
  • stylis doesn't support prefix position:sticky !important (however it does support position:sticky!important) yet, https://github.com/thysultan/stylis/pull/289

SukkaW avatar Apr 21 '22 21:04 SukkaW

Awesome. Really like to solution. Did you notice any file size changes?

sastan avatar Apr 23 '22 05:04 sastan

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.

SukkaW avatar Apr 23 '22 06:04 SukkaW

[email protected] has been released. Mark the PR ready to review.

SukkaW avatar Apr 23 '22 10:04 SukkaW

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.

sastan avatar May 09 '22 18:05 sastan

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.

sastan avatar Nov 18 '22 14:11 sastan