diff --git a/README.md b/README.md index c119ec1..6b22148 100644 --- a/README.md +++ b/README.md @@ -11,17 +11,15 @@ This utility ensures that when you combine multiple strings of Tailwind classes Using pip: ```bash -pip install tailwind-merge # Assuming this is the package name you'll use -# Or if installing directly from source: -# pip install . +pip install tailwind-merge ``` ## Usage ```python -from tailwind_merge import TailwindMerge # Adjust import if your file/package name differs +from tailwind_merge import TailwindMerge -# Initialize the merger (you can reuse the instance) +# Initialize twm = TailwindMerge() # --- Basic Merging --- @@ -39,14 +37,6 @@ result = twm.merge("pl-4 pr-6") # Left and Right padding coexist print(result) # Output: "pl-4 pr-6" -result = twm.merge("p-4 pl-8") # Specific left padding overrides general padding affecting left -print(result) -# Output: "pl-8" # Or potentially "p-4 pl-8" depending on exact conflict rules for p-* vs pl-* - -result = twm.merge("pl-8 p-4") # General padding defined later overrides specific padding -print(result) -# Output: "p-4" - # --- Modifier Handling --- # Modifiers (hover:, focus:, md:, etc.) are handled correctly. # Conflicts are resolved independently for base classes and each modifier combination. @@ -60,13 +50,9 @@ print(result) # --- Arbitrary Value Support --- # Classes with arbitrary values are correctly grouped and merged. -result = twm.merge("p-[2px] p-1") -print(result) -# Output: "p-1" - -result = twm.merge("m-1 m-[3vh]") +result = twm.merge("p-1", "p-[2px]") print(result) -# Output: "m-[3vh]" +# Output: "p-[2px]" # --- Combining Multiple Strings --- # Pass multiple strings as arguments diff --git a/tailwind_merge/__init__.py b/tailwind_merge/__init__.py index 17faa82..f6a46be 100644 --- a/tailwind_merge/__init__.py +++ b/tailwind_merge/__init__.py @@ -1,4 +1,4 @@ from .core import TailwindMerge -__version__ = "0.1.0" +__version__ = "0.3.0" __all__ = ["TailwindMerge"] \ No newline at end of file diff --git a/tailwind_merge/core.py b/tailwind_merge/core.py index 56b57d1..39d0d93 100644 --- a/tailwind_merge/core.py +++ b/tailwind_merge/core.py @@ -181,7 +181,6 @@ def __init__(self): ('border_width_r', ['border-r', 'border-r-0', 'border-r-2', 'border-r-4', 'border-r-8']), ('border_width_b', ['border-b', 'border-b-0', 'border-b-2', 'border-b-4', 'border-b-8']), ('border_width_l', ['border-l', 'border-l-0', 'border-l-2', 'border-l-4', 'border-l-8']), - # Tailwind also has border-x, border-y but let's keep it simpler for now or add if needed # --- End Border Width --- # Border Color (Needs care with opacity potentially)