Skip to content

Commit

Permalink
Fix z-*! utilities (#16795)
Browse files Browse the repository at this point in the history
Closes #16794
  • Loading branch information
philipp-spiess authored Feb 25, 2025
1 parent b389483 commit ef57e6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Vite: Don't crash when importing a virtual module in JavaScript that ends in `.css` ([#16780](https://github.com/tailwindlabs/tailwindcss/pull/16780))
- Ensure `@reference "…"` does not emit CSS variables ([#16774](https://github.com/tailwindlabs/tailwindcss/pull/16774))
- Fix an issue where `@reference "…"` would sometimes omit keyframe animations ([#16774](https://github.com/tailwindlabs/tailwindcss/pull/16774))
- Ensure `z-*!` utilities are property marked as `!important` ([#16795](https://github.com/tailwindlabs/tailwindcss/pull/16795))

## [4.0.8] - 2025-02-21

Expand Down
2 changes: 1 addition & 1 deletion packages/tailwindcss/src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ function applyImportant(ast: AstNode[]): void {
continue
}

if (node.kind === 'declaration' && node.property[0] !== '-' && node.property[1] !== '-') {
if (node.kind === 'declaration' && !(node.property[0] === '-' && node.property[1] === '-')) {
node.important = true
} else if (node.kind === 'rule' || node.kind === 'at-rule') {
applyImportant(node.nodes)
Expand Down
6 changes: 5 additions & 1 deletion packages/tailwindcss/src/important.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,17 @@ test('variables in utilities should not be marked as important', async () => {
}
@tailwind utilities;
`,
['ease-out!'],
['ease-out!', 'z-10!'],
),
).toMatchInlineSnapshot(`
":root, :host {
--ease-out: cubic-bezier(0, 0, .2, 1);
}
.z-10\\! {
z-index: 10 !important;
}
.ease-out\\! {
--tw-ease: var(--ease-out);
transition-timing-function: var(--ease-out) !important;
Expand Down

0 comments on commit ef57e6e

Please # to comment.