Skip to content

Commit ef57e6e

Browse files
Fix z-*! utilities (#16795)
Closes #16794
1 parent b389483 commit ef57e6e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- Vite: Don't crash when importing a virtual module in JavaScript that ends in `.css` ([#16780](https://github.com/tailwindlabs/tailwindcss/pull/16780))
1919
- Ensure `@reference "…"` does not emit CSS variables ([#16774](https://github.com/tailwindlabs/tailwindcss/pull/16774))
2020
- Fix an issue where `@reference "…"` would sometimes omit keyframe animations ([#16774](https://github.com/tailwindlabs/tailwindcss/pull/16774))
21+
- Ensure `z-*!` utilities are property marked as `!important` ([#16795](https://github.com/tailwindlabs/tailwindcss/pull/16795))
2122

2223
## [4.0.8] - 2025-02-21
2324

packages/tailwindcss/src/compile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ function applyImportant(ast: AstNode[]): void {
304304
continue
305305
}
306306

307-
if (node.kind === 'declaration' && node.property[0] !== '-' && node.property[1] !== '-') {
307+
if (node.kind === 'declaration' && !(node.property[0] === '-' && node.property[1] === '-')) {
308308
node.important = true
309309
} else if (node.kind === 'rule' || node.kind === 'at-rule') {
310310
applyImportant(node.nodes)

packages/tailwindcss/src/important.test.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,17 @@ test('variables in utilities should not be marked as important', async () => {
9898
}
9999
@tailwind utilities;
100100
`,
101-
['ease-out!'],
101+
['ease-out!', 'z-10!'],
102102
),
103103
).toMatchInlineSnapshot(`
104104
":root, :host {
105105
--ease-out: cubic-bezier(0, 0, .2, 1);
106106
}
107107
108+
.z-10\\! {
109+
z-index: 10 !important;
110+
}
111+
108112
.ease-out\\! {
109113
--tw-ease: var(--ease-out);
110114
transition-timing-function: var(--ease-out) !important;

0 commit comments

Comments
 (0)