Skip to content

Fix syntax error when resetting multi-word theme key namespaces #1237

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

Merged
merged 4 commits into from
Feb 26, 2025

Conversation

thecrypticace
Copy link
Contributor

Fixes #1236

This PR fixes an issue where we'd show a syntax error for multi-word namespace resets like --font-weight-*: initial;:

@theme {
  --font-*: initial; /* this one is fine */
  --font-weight-*: initial; /* this one shows a syntax error */
}
Screenshot 2025-02-26 at 12 16 38

Now both work as expected:

Screenshot 2025-02-26 at 12 17 09

@@ -74,7 +74,7 @@ export function rewriteCss(css: string) {
})

// Replace `--some-var-*` with `--some-var-_`
css = css.replace(/--([a-zA-Z0-9]+)-[*]/g, '--$1_')
css = css.replace(/--([a-zA-Z0-9-]+)-[*]/g, '--$1-_')
Copy link
Member

Choose a reason for hiding this comment

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

hehe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right?! lol

@thecrypticace thecrypticace merged commit 4cb548e into main Feb 26, 2025
@thecrypticace thecrypticace deleted the fix/theme-key-namespace-reset branch February 26, 2025 17:52
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.

Regression in v0.14.7: Font weight reset of defaults in @theme shows errors
2 participants