Skip to content
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

Invalid CSS when extending theme with semanticTokens #754

Closed
1 of 3 tasks
dsumer opened this issue Jun 20, 2023 · 4 comments
Closed
1 of 3 tasks

Invalid CSS when extending theme with semanticTokens #754

dsumer opened this issue Jun 20, 2023 · 4 comments

Comments

@dsumer
Copy link

dsumer commented Jun 20, 2023

Description

Currently Panda produces invalid CSS when extending the theme with semanticTokens, which results in unusable tokens.

e.g. my theme looks like this:

  theme: {
    extend: {
      semanticTokens: defineSemanticTokens({
        colors: {
          customRed: {
            value: { _base: '{colors.red.800}', _dark: '{colors.red.200}' },
          },
        },
      }),
    },
  },

then the last lines of the output CSS in styled-system/tokens/index.css looks like this:

  ...
  --colors-color-palette-500: var(--colors-color-palette-500);
  --colors-color-palette-600: var(--colors-color-palette-600);
  --colors-color-palette-700: var(--colors-color-palette-700);
  --colors-color-palette-800: var(--colors-color-palette-800);
  --colors-color-palette-900: var(--colors-color-palette-900)
}

{
  --colors-custom-red: #991b1b
}

.dark {
  --colors-custom-red: #fecaca
}
  }
  

Thank you so much for creating Panda, this is just awesome!

Link to Reproduction

https://stackblitz.com/edit/vitejs-vite-1z5hns?file=panda.config.ts

Steps to reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error

JS Framework

No response

Panda CSS Version

0.3.2

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

@anubra266
Copy link
Collaborator

anubra266 commented Jun 20, 2023

@dsumer just noting that it's base not _base

@segunadebayo
Copy link
Member

Here's a working Stackblitz
https://stackblitz.com/edit/vitejs-vite-nt8jwv?file=panda.config.ts,src%2FApp.tsx

@anubra266
Copy link
Collaborator

After testing, can confirm that using _base is what caused the issue.

@dsumer
Copy link
Author

dsumer commented Jun 20, 2023

ouch, yes that fixes the problem, thanks for pointing this out and for the incredibly fast responses!

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

No branches or pull requests

3 participants