Skip to content

A TailwindCSS class merge utility similar to Shadcn UI / Tailwind Merge

License

Notifications You must be signed in to change notification settings

AaronLayton/tailwind-merge-nuget

Repository files navigation

tailwind-merge-nuget

A TailwindCSS class merge utility similar to Shadcn UI / Tailwind Merge

https://github.com/YieldStudio/tailwind-merge-php/tree/main

NOTE this is a very simple implementation of Tailwind class merging and likely has many, many edge cases that are not covered. It is a simple implementation that works for my current use case. If you find a bug, please submit a PR with a test case and I will strive to update this package.

Usage

@using TailwindMerge
@{
    var conditionalCheck = true;
}

<div class="@TW.Merge(
    "bg-red-500", 
    "text-white", 
    conditionalCheck ? "p-4" : "p-2",
    "flex flex-col justify-center items-center"
)">
    Hello World
</div>

Tests being implemented to match https://github.com/dcastil/tailwind-merge/tree/main/tests

About

A TailwindCSS class merge utility similar to Shadcn UI / Tailwind Merge

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages