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 post process classes #16

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

javierav
Copy link
Collaborator

This PR implements TailwindMerge and its configuration. It has been implemented globally so that the cache it incorporates is shared and used by all ClassVariants instances.

@javierav javierav force-pushed the feature/tailwind-merge branch from 8accf97 to b23e493 Compare October 17, 2024 12:51
@javierav
Copy link
Collaborator Author

@adrianthedev tailwind_merge-0.13.1 requires ruby version < 4.0, >= 3.1 Should we drop support for Ruby 3.0?

@javierav javierav force-pushed the feature/tailwind-merge branch from b23e493 to eac6f7d Compare October 17, 2024 12:56
@javierav javierav mentioned this pull request Oct 18, 2024
@javierav
Copy link
Collaborator Author

I'm not entirely convinced by the proposal of this PR, since we are just integrating with TailwindMerge. I think it would be better to allow something more generic and let the developer decide. What do you think @adrianthedev?

ClassVariants.configure do |config|
  config.process_classes_with do |classes|
     TailwindMerge::Merger.new.merge(classes)
  end
end

@adrianthedev
Copy link
Contributor

Yeah. That could work as well.
We could expose this precise block in the initializer. Maybe commented out for those who don't want to add TailwindMerge as a dependecy.

@javierav javierav changed the title Add support for TailwindMerge Add support for post process classes Oct 24, 2024
@javierav javierav force-pushed the feature/tailwind-merge branch 3 times, most recently from 5863ef4 to 1f95f93 Compare October 24, 2024 09:55
@javierav javierav marked this pull request as ready for review October 24, 2024 09:56
@javierav javierav requested a review from adrianthedev October 24, 2024 09:56
@javierav
Copy link
Collaborator Author

@adrianthedev ready for review!

@javierav javierav force-pushed the feature/tailwind-merge branch from 1f95f93 to e15dbac Compare October 24, 2024 10:02
@javierav javierav force-pushed the feature/tailwind-merge branch from e15dbac to 2c3588d Compare October 24, 2024 10:15
Comment on lines +3 to +8
# ClassVariants.configure do |config|
# # allow to post process classes with an external utility like TailwindMerger
# config.process_classes_with do |classes|
# TailwindMerge::Merger.new.merge(classes)
# end
# end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about generating the initializer uncommented and leave only the process_classes_with option commented out, but I think I like this approach better.
We are not configuring anything with it, we might as well not load it.
Good call!

Copy link
Contributor

@adrianthedev adrianthedev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesoem work @javierav!

@adrianthedev adrianthedev merged commit f04e762 into avo-hq:main Oct 24, 2024
8 checks passed
@javierav javierav deleted the feature/tailwind-merge branch October 24, 2024 10:25
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