tailwindcss/crates
Robin Malfait 0612ddc7dc
Add Twig pre-processor (#20198)
This PR fixes an issue where `addClass(opacity-50)` and
`removeClass(opacity-50)` in Twig templates isn't extracted properly.

This fixes that by adding a pre-processor for `.twig` files. This is a
simple initial implementation where we drop the `(` and `)` from the
`addClass` and `removeClass` functions. We don't do any special handling
around escaped characters or parenthesis inside of strings. We will add
them when there is a use case for it. Until then, we'll keep it simple.

If the real API would've been `addClass('opacity-50')` then it would've
worked out of the box.

A workaround you can use today is by using spaces `addClass( opacity-50
)` that works as well.

Fixes: #19458
Closes: #20110

## Test plan

1. Added new tests for `twig` extraction
2. Added tests with nested `(` and `)` e.g. `addClass(p-(--value))`
which should properly extarct `p-(--value)`
2026-06-04 11:44:13 +02:00
..
classification-macros Improve boundary classification (#17005) 2025-03-07 00:00:54 +00:00
ignore Incorporate changes from latest ignore crate (#19148) 2025-10-20 09:49:40 -04:00
node Update @napi-rs/cli 3.6.2 → 3.7.0 (minor) (#20197) 2026-06-04 10:31:08 +02:00
oxide Add Twig pre-processor (#20198) 2026-06-04 11:44:13 +02:00