Skip to content

Styled components and integrating with vite's react plugin #578

Answered by ben-rogerson
leanmiguel asked this question in Q&A
Discussion options

You must be logged in to vote

Hey there, great you saw I just updated the styled components + vite example. I still need to update the remaining next examples too.

Here's the section from the readme that explains how twin works:

When babel runs over your javascript or typescript files at compile time, twin grabs your classes and converts them into css objects. These css objects are then passed into your chosen css-in-js library without the need for an extra client-side bundle:

import tw from 'twin.macro'

tw`text-sm md:text-lg`

// ↓ ↓ ↓ ↓ ↓ ↓

{
 fontSize: '0.875rem',
 '@media (min-width: 768px)': {
   fontSize: '1.125rem',
 },
}

Did you have any questions on top of this?

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@leanmiguel
Comment options

@ben-rogerson
Comment options

@leanmiguel
Comment options

@FezVrasta
Comment options

Answer selected by leanmiguel
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