Skip to content

Preserve source locations for JavaScript keyframes - #20709

Closed
darrenfdes wants to merge 1 commit into
tailwindlabs:mainfrom
darrenfdes:fix/postcss-keyframe-sources
Closed

darrenfdes wants to merge 1 commit into
tailwindlabs:mainfrom
darrenfdes:fix/postcss-keyframe-sources

Conversation

@darrenfdes

Copy link
Copy Markdown

Summary

Vite's URL rewriter warns when a PostCSS declaration has no source file. In development, @tailwindcss/postcss converts Tailwind's AST directly to PostCSS nodes. The keyframes created from JavaScript theme configs lack source locations, so their declarations trigger the warning even when Vite supplied from for the input stylesheet.

Keep the source of each keyframe as configs are merged and attach it to the generated rule and its children. This gives PostCSS the source of the @config or @plugin directive that contributed the keyframe.

Related to #20452. The case reproduced here uses a JavaScript config with theme.extend.keyframes and its matching animation utility.

Test plan

  • Confirmed the regression test fails on main with missing source files and passes with this change. It covers keyframes from a base config and a separate extension config.
  • Ran pnpm exec vitest run --hideSkippedTests and node scripts/changelog.mjs check.
  • Verified a Vite 8.2.0 dev stylesheet transform with @tailwindcss/postcss emits the configured keyframes and no longer logs the missing from warning.

@darrenfdes
darrenfdes requested a review from a team as a code owner November 12, 2026 07:01
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Reviews (1) · Last reviewed commit: "Preserve source locations for JavaScript..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Config resolution now tracks source locations for keyframes from base configurations and theme extensions. Compatibility hooks pass the resulting map to applyKeyframesToTheme, which assigns matching locations to generated keyframe rules and their nodes. A PostCSS regression test checks the source file and line numbers for keyframes generated from JavaScript configuration. The changelog records the Vite warning scenario.

Severity of issue fixed: Low

Merge Risk: Minimal · up to 4a0ae

This change preserves source locations for keyframes defined in JavaScript configs. That should remove the Vite missing-from warning. The change is additive and has a regression test, so no merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Preserve source locations for JavaScript keyframes" names the main change. The changeset keeps source locations for keyframes that come from JavaScript configs, through config merging and i…
Description check Passed The description states the problem: Vite's URL rewriter warns when a PostCSS declaration lacks a source file, and keyframes from JavaScript theme configs lack source locations. It then describes the f…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Preserve source locations for JavaScript keyframes" names the main change. The changeset keeps source locations for keyframes that come from JavaScript configs, through config merging and into the generated keyframe rules and their children.

Full details: Description check

Explanation

The description states the problem: Vite's URL rewriter warns when a PostCSS declaration lacks a source file, and keyframes from JavaScript theme configs lack source locations. It then describes the fix (keeping each keyframe's source during config merges and attaching it to the rule and children), the regression test, and the verification steps. This matches the changed files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 47d3bad2-d4b3-464c-b15f-e5f64703cbe5
Commits

Reviewing files that changed from the base of the PR and between b08bf83 and 4a0ae6e.

Files selected for processing: 5

  • .changelog/postcss-keyframe-sources.md
  • packages/@tailwindcss-postcss/src/index.test.ts
  • packages/tailwindcss/src/compat/apply-compat-hooks.ts
  • packages/tailwindcss/src/compat/apply-keyframes-to-theme.ts
  • packages/tailwindcss/src/compat/config/resolve-config.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant