Skip to content

Commit 393844d

Browse files
sisi-shGatsbyJS Bot
authored and
GatsbyJS Bot
committed
Update tailwind-css.md CSS-in-JS instructions (#16443)
* Update tailwind-css.md css-in-js instructions * Add more supporting comments, fix indentation * chore: format
1 parent e754103 commit 393844d

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

docs/docs/tailwind-css.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ This guide assumes that you have a Gatsby project set up. If you need to set up
2323
npm install tailwindcss --save-dev
2424
```
2525

26-
2. Generate Tailwind config file
26+
2. Generate Tailwind config file (optional)
27+
28+
**Note**: A config file isn't required for Tailwind 1.0.0+
2729

2830
To configure Tailwind, we'll need to add a Tailwind configuration file. Luckily, Tailwind has a built-in script to do this. Just run the following command:
2931

@@ -67,8 +69,23 @@ These steps assume you have a CSS-in-JS library already installed, and the examp
6769

6870
1. Install Tailwind Babel Macro
6971

72+
**Note**: `tailwind.macro` isn't currently compatible with Tailwind 1.0.0+. However, a compatible beta is available at `tailwind.macro@next`. Feel free to either use the beta or revert to TailwindCSS 0.7.4.
73+
74+
**Option 1**: Install `tailwind.macro@next` and use Tailwind 1.0.0+
75+
7076
```shell
71-
npm install --save tailwind.macro
77+
npm install --save tailwind.macro@next
78+
```
79+
80+
**Option 2**: Install stable `tailwind.macro` and use Tailwind 0.7.4
81+
82+
```bash
83+
// Remove tailwind 1.0.0+ if you've already installed it
84+
npm uninstall tailwindcss
85+
86+
// Install tailwind 0.7.4 and stable tailwind.macro
87+
npm install [email protected]
88+
npm install tailwind.macro
7289
```
7390
7491
2. Use the Babel Macro (tailwind.macro) in your styled component
@@ -77,9 +94,15 @@ npm install --save tailwind.macro
7794
import styled from "styled-components"
7895
import tw from "tailwind.macro"
7996
97+
// All versions
8098
const Button = styled.button`
8199
${tw`bg-blue hover:bg-blue-dark text-white p-2 rounded`};
82100
`
101+
102+
// tailwind.macro@next
103+
const Button = tw.button`
104+
bg-blue hover:bg-blue-dark text-white p-2 rounded
105+
`
83106
```
84107
85108
## Other resources

0 commit comments

Comments
 (0)