Skip to content

fix(hast-util-to-babel-ast): preserve CSS custom property values#1021

Open
HondaYt wants to merge 1 commit intogregberge:mainfrom
HondaYt:fix/css-var-unit
Open

fix(hast-util-to-babel-ast): preserve CSS custom property values#1021
HondaYt wants to merge 1 commit intogregberge:mainfrom
HondaYt:fix/css-var-unit

Conversation

@HondaYt
Copy link
Copy Markdown

@HondaYt HondaYt commented Feb 4, 2026

Summary

  • Preserve CSS custom property (--*) values as strings when converting inline styles.
  • Add a regression test to ensure units like px, rem, %, and complex values are kept.

Motivation

React does not auto-append units for CSS custom properties, so numeric conversion strips units and breaks rendering. This keeps --* values as raw strings.

Note: CSS custom property values are now emitted as strings (e.g. --index: 1 -> "1").

Test plan

  • pnpm test -- packages/hast-util-to-babel-ast/src/index.test.ts

Fixes #1020

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 4, 2026

@HondaYt is attempting to deploy a commit to the Greg Berg's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

SVGR strips px from CSS variables in inline styles

1 participant