Skip to content

Add support for using bad characters as separators#6

Open
hritikaggarwal2 wants to merge 3 commits into
milamer:mainfrom
hritikaggarwal2:user/hritikaggarwal2/bugFixes
Open

Add support for using bad characters as separators#6
hritikaggarwal2 wants to merge 3 commits into
milamer:mainfrom
hritikaggarwal2:user/hritikaggarwal2/bugFixes

Conversation

@hritikaggarwal2
Copy link
Copy Markdown

What:
Added the ability to use bad characters as separators (like space).
Also added some logic to allow condensing whitespaces. This is useful for especially when a whitespace is set as a separator character

Why:
Currently, we cannot add bad characters as separators. Due to this, we cannot use common separators like (space)

How:
Added logic to check for separator and removed it from the badChars. Also added logic to allow user to condense whitespaces while testing the changes

Checklist:

  • [X ] Documentation
  • Tests
  • Ready to be merged

Closes #4 and #5

@hritikaggarwal2
Copy link
Copy Markdown
Author

@milamer Checking in to see your thoughts on this 😄

@milamer
Copy link
Copy Markdown
Owner

milamer commented Oct 15, 2024

Hey @hritikaggarwal2

Thanks for the PR!
I understand the intention to allow more flexibility in using characters as separators, but this opens up several potential issues.
Using characters like whitespace and other "bad" characters can cause conflicts, for example [ since Tailwind already uses for arbitrary variants, and as it acts as a class separator.

To avoid unintended issues, we’d need thorough testing before considering this change.
I'll reflect on it more and get back to you.

@hritikaggarwal2
Copy link
Copy Markdown
Author

Hey @milamer,

That's a great point! I have been testing this solution with (whitespaces) and as long as I set compressWhitespaces to true, I don't get any issues.

But I understand that there might not be an easy fix for Tailwind special characters like [. To go around this, maybe the list of bad characters can be trimmed down to being characters that we absolutely can't work with (like [ and ])!?

Also, as I am thinking about this, introducing another function such that the continuous separator characters can be condensed down together (ex. a:(mx-4,,,,my-2) => a:(mx-4,my-2) => a:mx-4 a:my-2) might also be useful. This can avoid us explicitly setting compressWhitespaces for whitespace separators and also improve the overall use cases

Appreciate your response and looking forward to your thoughts on this :)

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 this pull request may close these issues.

Whitespaces around variant groups break the system

2 participants