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

Add support for React JSX #37

Merged
merged 2 commits into from
Dec 6, 2020
Merged

Add support for React JSX #37

merged 2 commits into from
Dec 6, 2020

Conversation

ulken
Copy link

@ulken ulken commented Dec 2, 2020

Adds support for React JSX(/TSX) by (optionally) looking for className (not only class).

@ulken
Copy link
Author

ulken commented Dec 4, 2020

@abdumu Thoughts?

I've used this locally and while it's not 100% perfect it works for most cases. It doesn't handle cases where not a plain quotation is used, but rather a helper function to generate classes, but that's expected/fine, I'd say.

@abdumu
Copy link
Member

abdumu commented Dec 4, 2020

Thank you for adding this.

Could you add at least one test?

@ulken
Copy link
Author

ulken commented Dec 4, 2020

Sure, I'll give it a try.

I found the test suite rather sparse, which is why I didn't add one to begin with.

@ulken
Copy link
Author

ulken commented Dec 4, 2020

Any plans of supporting 2.0? Either for this or tailshift.

@ulken
Copy link
Author

ulken commented Dec 4, 2020

On a related note: to be framework agnostic, have you considered simply using a regex similar to what PurgeCSS does out-of-the-box?

/[^<>"'`\s]*[^<>"'`\s:]/g

To quote Tailwind CSS:

This basically matches any string separated by spaces, quotes or angle brackets, including HTML tags, attributes, classes, and even the actual written content in your markup.

@ulken
Copy link
Author

ulken commented Dec 4, 2020

@abdumu Test added

@abdumu abdumu merged commit 9ed2814 into awssat:master Dec 6, 2020
@abdumu
Copy link
Member

abdumu commented Dec 6, 2020

thanks

@abdumu abdumu mentioned this pull request Jun 24, 2021
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.

2 participants