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

feat: add twMerge #298

Merged
merged 2 commits into from
Feb 7, 2025
Merged

feat: add twMerge #298

merged 2 commits into from
Feb 7, 2025

Conversation

ell-ska
Copy link
Contributor

@ell-ska ell-ska commented Feb 6, 2025

  • install the package twMerge
  • update the places where we merge component classes with the attribute class

explanation of the package

TailwindMerge for Laravel allows you to merge multiple Tailwind CSS classes and automatically resolves conflicts between classes by removing classes conflicting with a class defined later. This is especially helpful when you want to override Tailwind CSS classes in your Blade components.

demo of the issue this solves

<x-button class="hidden sm:inline-flex">
    should be hidden on mobile
</x-button>
<x-button class="sm:hidden">should be hidden on desktop</x-button>

before twMerge
https://github.com/user-attachments/assets/f635a6c3-f9af-4ab2-a675-540a79b847a9

after twMerge

Skarminspelning.2025-02-06.kl.15.44.35.mov

@ell-ska ell-ska temporarily deployed to feat-add-twMerge - u04-imdb-clone PR #298 February 6, 2025 14:51 — with Render Destroyed
@ell-ska ell-ska temporarily deployed to feat-add-twMerge - u04-imdb-clone PR #298 February 6, 2025 14:53 — with Render Destroyed
Copy link
Contributor

@DavidDyberg DavidDyberg left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@beforeAW beforeAW left a comment

Choose a reason for hiding this comment

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

Great

@ell-ska ell-ska merged commit dbf1c2a into main Feb 7, 2025
1 check passed
@ell-ska ell-ska deleted the feat-add-twMerge branch February 7, 2025 11:12
@beforeAW beforeAW self-requested a review February 7, 2025 11:12
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.

3 participants