Skip to content
Discussion options

You must be logged in to vote

@bernhardw recipe runtime functions return a string of the generated class name. So there is no way to extract the style rules from it. You could do something like this:

const fontStyles = {
  base: {
    lineHeight: '1.5em'
  },
  variants: {
    size: {
      medium: {
        fontSize: '1rem'
      }
    }
  }
}

export const font = recipe(fontStyles);

globalStyle('body', {
  margin: 0,
  ...fontStyles.base,
  ...fontStyles.variants.size.medium
});

You would likely need to play around with the types to get better intellisense. But as far as I am aware there is no native way to do this.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bernhardw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants