Ignore unknown at-rule warnings for @position-try (#20277)

This PR ignores Lightning CSS warnings for the unknow at-rule
`@position-try`.

This is a temporary fix/workaround until support for `@position-try`
lands in Lightning CSS:
https://github.com/parcel-bundler/lightningcss/pull/1238

Fixes: #20275

## Test plan

Ran a test based on the issue:

Before:
```shellsession
❯ tw -i x.css -o out.css --optimize
≈ tailwindcss v4.3.1

Found 1 warning while optimizing generated CSS:

│   position-try-fallbacks: --flip-above;
│ }
│ @position-try --flip-above {
┆              ^-- Unknown at rule: @position-try
┆
│   top: auto;
│   bottom: 0;

Done in 29ms
```

After:
```shellsession
❯ tw -i x.css -o out.css --optimize
≈ tailwindcss v4.3.1

Done in 14ms
```
This commit is contained in:
Robin Malfait 2026-06-25 13:21:12 +02:00 • committed by GitHub
parent bb6a10937c
commit 7ff413bad4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,6 +68,13 @@ export function optimize(
return false
}
// Ignore warnings about unknown at-rules.
//
// TODO: drop `@position-try` once https://github.com/parcel-bundler/lightningcss/pull/1238 lands
if (/Unknown at rule: @position-try/.test(warning.message)) {
return false
}
return true
})