Replies: 2 comments 5 replies
-
Hey there, I looked into separating the global styles into chunks that could be imported but didn't think the extra complexity was needed. Example with styled-components: import { createGlobalStyle } from 'styled-components'
import tw, { theme, globalStyles } from 'twin.macro'
const globals = {
body: {
WebkitTapHighlightColor: theme`colors.purple.500`,
...tw`antialiased`,
},
}
const globalStylesAdjustments = Object.entries(globalStyles).filter(style => ...)
const GlobalStyles = createGlobalStyle(globalStylesAdjustments, globals) // Use two arguments so a deep merge happens
export default GlobalStyles |
Beta Was this translation helpful? Give feedback.
-
Hi @ben-rogerson I'm currently facing an issue where my component is not animating when using translate and realise I need to import Although this resets all CSS selectors to the default value which breaks the font appearance of my theme and after checking the code, I saw there is several sets of styles but it is exported as one variable. Seconding @Alphy11 if it is possible to have the set of styles exported independently? What I did is create a new JS file in my project containing the code from https://github.com/ben-rogerson/twin.macro/blob/master/src/config/globalStyles.js but I exclude That helps in getting the animation working without resetting the font appearance for most HTML text elements (especially heading and paragraph). For reference, I was following issue #277 and #542 which the solution didn't help for my use case (or maybe I'm approaching it wrongly). Not sure if this helps but I'm using |
Beta Was this translation helpful? Give feedback.
-
At the moment, it seems the GlobalStyles component is also the thing that defaults all the tailwind variables. Would the maintainers be supportive of a change that separated them (then composed them back as the same interface as today for those who want to use the styling)?
Beta Was this translation helpful? Give feedback.
All reactions