Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve sorting #1973

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

refactor: improve sorting #1973

wants to merge 1 commit into from

Conversation

sibbng
Copy link
Member

@sibbng sibbng commented Dec 6, 2022

This PR does a few things:

1. refactors mergeSelectors to merge only consecutive selectors

Previously it was merging classes across whole generated results. This was changing the order of some utilities and cause some issues like #1967 and #1978.

I tested the merge behaviour with cssnano, esbuild, and lightningcss. As far as I see, they are all only merging the consecutive selectors. I don't even know why we have this feature though.

2. Consistent sorting

I made some improvements to our sorting logic. These improvements are bringing it closer to the output of Tailwind. But they caused some mergeable selectors to be rendered far from each other. To fix that, I needed to make more changes.

Roughly sorting changes are:

  • Variants always come last
  • Pseudos come just before variants
  • Arbitrary CSS properties come before pseudos
  • CSS variables (object-$something), come before arbitrary CSS properties

@netlify
Copy link

netlify bot commented Dec 6, 2022

Deploy Preview for unocss ready!

Name Link
🔨 Latest commit e9a9468
🔍 Latest deploy log https://app.netlify.com/sites/unocss/deploys/638f9d3fd392ed0009541da7
😎 Deploy Preview https://deploy-preview-1973--unocss.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sibbng
Copy link
Member Author

sibbng commented Dec 6, 2022

failing tests don't work on windows, I will fix them later on codespaces

@stale
Copy link

stale bot commented Feb 8, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Apr 28, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant