Install

Works with Drupal: ^10.3 || ^11 || ^12

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 17.87 KB
MD5: f135d658b71e4368ba3a0a57a5575a3a
SHA-1: 0a055e31d800c36388769e106d7dc48275e00444
SHA-256: ed0a1f40b00eb47899ae9c7e379b36e8f5a9c8ff3764675d3794453b9dca1926
Download zip 28.65 KB
MD5: b783afd270a90ac28da13782707ce924
SHA-1: e9b82d086325d37d8e177bdcf863f8296ee433f7
SHA-256: 80c2e7144d23f133fa5c94e3064d9859c86969ca230611c8e47b70e347bc8ec4

Release notes

New: the tw_merge filter

Merge classes with the new tw_merge Twig filter. It follows its input, so there is no option to set:

  • {{ 'p-4 bg-white p-2'|tw_merge }} outputs bg-white p-2
  • {{ ['p-4', 'bg-white', 'p-2']|tw_merge }} outputs bg-white p-2
  • {{ attributes.addClass(['p-4', 'bg-white', 'p-2']|tw_merge).removeClass('p-2') }} outputs class="bg-white"

Legacy functions still work

The tw_merge() and tw_merge_as_array() functions, including the as='string' and as='array' options, were not removed. Existing templates keep working without changes. They are described in LEGACY.md, with their filter equivalents.

Prefix

  • Enter the prefix as in prefix(tw), for example tw, for classes like tw:flex.
  • Spaces, a trailing colon and capital letters are fixed automatically when you save. tw:, tw and TW are all saved as tw.
  • Like Tailwind CSS 4.x, only letters (a-z) are accepted. Anything else, such as tw-, shows an error and is not saved.

Library update

Now requires tales-from-a-dev/tailwind-merge-php ^0.5.0. It sets up faster and uses less memory. A few utilities now merge differently, matching tailwind-merge 3.7.0:

  • outline-2 and outline now conflict.
  • opacity-50 and opacity-(--o) now conflict.
  • delay-100 and delay-initial no longer conflict.
  • skew-* no longer uses the spacing theme.

Other improvements

  • Faster: the merge library is created once, only when a page first merges classes.
  • Saving the prefix clears all rendered output, so the new prefix applies right away.
  • Kernel and functional tests cover the filter, the legacy functions, the prefix and the settings page.

API change for custom code

The Drupal\tailwind_merge_classes\Service\TailwindMergeService class and the tailwind_merge_classes.tailwind_merge_service service were removed. Custom code should use the Drupal\tailwind_merge_classes\TailwindMergeInterface service instead. Twig templates are not affected.

Created by: sergey_gabrielyan
Created on: 31 Oct 2026 at 18:04 UTC
Last updated: 31 Oct 2026 at 18:12 UTC
New features

Other releases