Skip to content

Issue with Panda CSS Generating Extra Tokens #2557

Answered by astahmer
mahanfakhimi asked this question in Q&A
Discussion options

You must be logged in to vote

you can use a postcss plugin to achieve that like this one
https://github.com/astahmer/pandabox/blob/main/packages/postcss-plugins/src/remove-unused-css-vars.ts

note that by doing so, you will not be able to use token(xxx) where xxx is a token path (leading to a CSS var) that wasn't explicitly used in your app code (from the include of panda.config.ts), as the postcss plugin only looks at the generated CSS and removes any CSS variable not referenced in some CSS rule

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@astahmer
Comment options

@kris-ellery
Comment options

@astahmer
Comment options

@kris-ellery
Comment options

@astahmer
Comment options

Answer selected by segunadebayo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2556 on May 02, 2024 10:10.