Extending Tailwind preflight #720
Unanswered
therealgilles
asked this question in
Q&A
Replies: 3 comments 10 replies
-
Something like this you can spread into your global styles (I like using object syntax): import tw from 'twin.macro'
const baseStyles = {
h1: tw`text-2xl`,
// ...
a: tw`text-blue-600 underline`,
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thank you for the quick replies! |
Beta Was this translation helpful? Give feedback.
7 replies
-
Here is what seems to work for hot module replacement: // GlobalStyles.tsx
import React from 'react' // if you need it
import { Global } from '@emotion/react'
import tw from 'twin.macro'
const customStyles = {
body: tw`font-sans antialiased`,
h1: tw`text-2xl font-semibold`,
}
const GlobalStyles = () => <Global styles={customStyles} />
export default GlobalStyles then in Layout.tsx: import tw, { GlobalStyles as BaseStyles } from 'twin.macro'
import GlobalStyles from '../styles/GlobalStyles'
...
<>
<BaseStyles />
<GlobalStyles />
...
<Header />
<Main />
<Footer />
</> Not sure why this works and not the two together. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the equivalent with GlobalStyles of the following?
Beta Was this translation helpful? Give feedback.
All reactions