GlobalyStyles
from "twin.macro" ruins some component styling, help needed.
#719
Replies: 2 comments 4 replies
-
yes, that is accurate
this might confuse the order of global styles causing some inheritance issues, it could be that the utility classes are getting overwritten by the css reset when using
hope that helps |
Beta Was this translation helpful? Give feedback.
-
If you are using emotion, I have found that it's better to combine base and custom global styles this way: const customStyles = css([
BaseStyles as TwStyle,
{
... custom global styles here
}
]) otherwise the order of BaseStyles vs custom global styles will be reversed on hot module replacement. |
Beta Was this translation helpful? Give feedback.
-
Hey guys!
Just finished transitioning from
tailwind-styled-components
totwin.macro
. First and foremost thank you for the amazing project. It will surely help me clean up some components.As guide for my setup, configurations, and code. I followed the example in
twin.examples
forNext.js
. However, I am facing a minor issue with some rendered UI. The issue only occurs when I useimport { css, GlobalStyles as BaseStyles } from "twin.macro"
and use like exemplified:I am using TailwindCSS 3.2 and Twin.Macro latest release candidate
Screenshots of the issues I detected and how they should look:
Before:
After:
Questions:
What exactly does
twin.macro#GlobalStyles
do?@tailwind base
plus some keyframes directivesWhat are the consequences of not using
twin.macro#GlobalStyles
and instead just importing@tailwind base
.Newbie version of the question
Given my current
styles/globals.css
(file below) is my translation toGlobalStyles.tsx
correct?Previous Global Styles (CSS):
New Global Styles (JS Twin Style):
Beta Was this translation helpful? Give feedback.
All reactions