Skip to content

fix(tailwind): stop silently dropping space-/divide- utilities#3593

Open
yashs33244 wants to merge 1 commit into
resend:canaryfrom
yashs33244:fix/tailwind-nested-rule-utilities
Open

fix(tailwind): stop silently dropping space-/divide- utilities#3593
yashs33244 wants to merge 1 commit into
resend:canaryfrom
yashs33244:fix/tailwind-nested-rule-utilities

Conversation

@yashs33244

@yashs33244 yashs33244 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

Tailwind utilities whose CSS compiles to a nested rule are silently dropped from the output: space-y-*, space-x-*, divide-y, divide-x, and divide-<color>. Putting them on an element produces no inline style, no <style> rule, and the class is removed too, so the spacing/dividers just disappear.

<Tailwind><Html><Head/><body>
  <div className="space-y-4"><p>one</p><p>two</p></div>
</body></Html></Tailwind>
// before: <div><p>one</p><p>two</p></div>  + empty <style></style>

These utilities compile to e.g. .space-y-4 { :where(& > :not(:last-child)) { … } }. css-tree leaves that nested body as a single unparsed Raw block child, and find() cannot descend into a Raw node, so isRuleInlinable/isPartInlinable see no pseudo-selector and judge the rule inlinable. makeInlineStylesFor then finds no Declaration nodes in the Raw and yields an empty style - the rule is dropped.

Fix

Treat a Raw node that is a direct block child as non-inlinable in both helpers, so the rule is kept and emitted in the <head> <style> block (with the class preserved) instead of vanishing. The check is on block children specifically, not any Raw, so a var() fallback like line-height: var(--tw-leading, var(--…)) (which css-tree also represents as Raw, but inside a declaration value) is unaffected and still inlines.

// after: div keeps class="space-y-4", and <head> <style> contains .space-y-4 { … }

Added a regression test asserting space-y-4/divide-y land in the non-inlinable set instead of being dropped. All 126 tailwind tests pass; text-lg, bg-red-500, and &:hover utilities still inline as before.


Summary by cubic

Stop dropping Tailwind nested-rule utilities like space-y-*, space-x-*, and divide-*. These are now kept as non-inlinable rules so the class stays on the element and CSS is emitted in the <head>.

  • Bug Fixes
    • Treat Raw block children as non-inlinable in is-rule-inlinable and is-part-inlinable.
    • Added regression test for space-y-4/divide-y; other inlining behavior remains unchanged.

Written for commit 7543b8b. Summary will update on new commits.

Review in cubic

Utilities like space-y-4 and divide-y compile to a nested rule whose
body css-tree leaves as an unparsed Raw block child. find() can't
descend into Raw, so isRuleInlinable/isPartInlinable judged them
inlinable; makeInlineStylesFor then found no declarations and emitted
an empty style, dropping the rule and its class entirely. Treat a Raw
block child as non-inlinable so the rule is kept in the <style> block.
Copilot AI review requested due to automatic review settings June 23, 2026 08:34
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@yashs33244 is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@changeset-bot

changeset-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7543b8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
react-email Patch
@react-email/editor Patch
@react-email/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Fix for silently dropped Tailwind nested-rule utilities; isolated to CSS inlining logic with added regression test.

Re-trigger cubic

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants