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

Global styles breakpoint incorrect ordering #562

Closed
ben-rogerson opened this issue Oct 19, 2021 · 0 comments · Fixed by #638
Closed

Global styles breakpoint incorrect ordering #562

ben-rogerson opened this issue Oct 19, 2021 · 0 comments · Fixed by #638

Comments

@ben-rogerson
Copy link
Owner

ben-rogerson commented Oct 19, 2021

I've forked this example and added a plugin to the tailwind config file using the addComponent function. And my css is added in wrong order, so the bug is there.

Plugin Log output
Screenshot 2021-10-13 at 10 27 10

CSS output
Screenshot 2021-10-13 at 10 25 45

Originally posted by @LouisJackson in #277 (comment)

The breakpoint order that's created by twin is incorrect:

{
  "--breakpoint": "\"sm\"",
  "@media (min-width: 1536px)": {
    "--breakpoint": "\"2xl\""
  },
  "@media (min-width: 1280px)": {
    "--breakpoint": "\"xl\""
  },
  "@media (min-width: 1024px)": {
    "--breakpoint": "\"lg\""
  },
  "@media (min-width: 768px)": {
    "--breakpoint": "\"md\""
  }
}

The culprit is the .reverse() here - the array reversal was added as styles in other situations were being supplied in reverse.
This deserves another review to see if an alternative fix can be made.

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

Successfully merging a pull request may close this issue.

1 participant