Repository navigation
fix(export): reject css-vars token names that are not CSS identifiers - #203
Open
giri-kondisetty wants to merge 1 commit into
Open
giri-kondisetty wants to merge 1 commit into
giri-kondisetty wants to merge 1 commit into
Conversation
The css-vars export wrote token names into the stylesheet with only dots
replaced, so a name such as 'x: 0; } a { color: red } :root { --y' closed
the :root block and added a rule of its own. The Tailwind v4 export already
rejects such names with INVALID_TOKEN_NAME.
Check colors, spacing and rounded names before emitting, and report the
error code the same way the other formats do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #202.
The
css-varsexport wrote token names into the stylesheet with only dots replaced. A name such asx: 0; } a { color: red } :root { --yclosed the:rootblock and added a rule of its own. The Tailwind v4 export already rejects such names.Changes:
CssVarsEmitterHandlerchecks colors, spacing and rounded names before emitting and returnsINVALID_TOKEN_NAMEfor a name that is not a CSS identifier.css-varsbranch of the export command prints the error code and message in the same shape as the other formats.The check is a little wider than the Tailwind one. It also accepts
_and non-ASCII characters, because both are valid in a CSS custom property name and I did not want to reject names that export correctly today.Not changed: the
--prefixvalue is still written as given. It comes from the person running the command, not from the file.Checked:
-,_, a leading digit, a group dot and a non-ASCII letter still export; the CLI exits 1 with no stylesheet on stdout.bun testinpackages/cli: 409 pass, 1 skip, 0 fail.bun run lintis clean.