Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we always emit @keyframes correctly #16237

Merged
merged 4 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!

### Fixed

- Ensure that the `containers` JS theme key is added to the `--container-*` namespace. ([#16169](https://github.com/tailwindlabs/tailwindcss/pull/16169))
- Fix missing `@keyframes` definition ([#16237](https://github.com/tailwindlabs/tailwindcss/pull/16237))

## [4.0.3] - 2025-02-01

Expand Down
39 changes: 39 additions & 0 deletions packages/tailwindcss/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,45 @@ describe('Parsing themes values from CSS', () => {
`)
})

test('`@keyframes` in `@theme` are generated when name contains a new line', async () => {
expect(
await compileCss(
css`
@theme {
--animate-very-long-animation-name: very-long-animation-name
var(
--very-long-animation-name-configuration,
2.5s ease-in-out 0s infinite normal none running
);

@keyframes very-long-animation-name {
to {
opacity: 1;
}
}
}

@tailwind utilities;
`,
['animate-very-long-animation-name'],
),
).toMatchInlineSnapshot(`
":root, :host {
--animate-very-long-animation-name: very-long-animation-name var(--very-long-animation-name-configuration, 2.5s ease-in-out 0s infinite normal none running);
}

.animate-very-long-animation-name {
animation: var(--animate-very-long-animation-name);
}

@keyframes very-long-animation-name {
to {
opacity: 1;
}
}"
`)
})

test('`@theme` values can be unset', async () => {
expect(
await compileCss(
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwindcss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ async function parseCss(
let keyframesRules = theme.getKeyframes()
if (keyframesRules.length > 0) {
let animationParts = [...theme.namespace('--animate').values()].flatMap((animation) =>
animation.split(' '),
animation.split(/\s+/),
)

for (let keyframesRule of keyframesRules) {
Expand Down