Drupal is a registered trademark of Dries Buytaert


Tailwind Merge Classes is a Drupal module for users working with Tailwind CSS in a component-based syntax. It provides a Twig extension that merges multiple Tailwind CSS classes, resolves conflicts automatically, and ensures a clean, optimized class list.

The module also supports Tailwind class prefixes starting from the stable 1.x version. If your Tailwind configuration uses a custom prefix (for example tw-), you can define this prefix in the module’s configuration.

Version Support

  • Module version 1.x: Compatible only with Tailwind CSS 3.x
  • Module version 2.x: Compatible only with Tailwind CSS 4.0 up to 4.1

Prefix Examples: In Tailwind CSS 3.x, prefixes use hyphens (-), e.g., tw-text-red-500, whereas in Tailwind CSS 4.x, prefixes use a colon (:), e.g., tw:text-red-500 in Twig.

Post-Installation

Once you install the Tailwind Merge Classes module, there's no need for extra configuration or managing content types. Simply enable the module and start using it in your Twig files. To merge Tailwind CSS classes, just use the tw_merge and tw_merge_as_array functions in your Twig templates. It will automatically handle merging and resolving conflicts without the need for additional configuration.

Third-Party Libraries

This module depends on different PHP packages to handle merging of Tailwind CSS classes for each Tailwind version.

Both PHP packages require PHP 8.1 and above.

Activity

Total releases
8
First release
Jan 2025
Latest release
1 month ago
Release cadence
52 days
Stability
63% stable

Release Timeline

Releases

Version Type Release date
2.1.0 Stable Jan 18, 2026
1.1.0 Stable Jan 18, 2026
2.0.0 Stable Dec 31, 2025
1.0.1 Stable Dec 28, 2025
1.0.0 Stable Dec 27, 2025
1.0.0-beta2 Pre-release Jun 19, 2025
1.0.0-beta1 Pre-release Jan 22, 2025
1.0.x-dev Dev Jan 20, 2025