Skip to content

Commit ba7279d

Browse files
authored
docs: update TailwindCSS v4 guide (#261)
* docs: update TailwindCSS v4 guide * tweak
1 parent 39b4ea8 commit ba7279d

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

README.md

+5-28
Original file line numberDiff line numberDiff line change
@@ -650,37 +650,12 @@ Like the followings:
650650
651651
### Using Tailwind CSS
652652
653-
Given that HonoX is Vite-centric, if you wish to utilize [Tailwind CSS](https://tailwindcss.com/), simply adhere to the official instructions.
653+
Given that HonoX is Vite-centric, if you wish to utilize [Tailwind CSS](https://tailwindcss.com/), basically adhere to [the official instructions](https://tailwindcss.com/docs/installation/using-vite).
654654
655-
Prepare `tailwind.config.js` and `postcss.config.js`:
656-
657-
```js
658-
// tailwind.config.js
659-
export default {
660-
content: ['./app/**/*.tsx'],
661-
theme: {
662-
extend: {},
663-
},
664-
plugins: [],
665-
}
666-
```
667-
668-
```js
669-
// postcss.config.js
670-
export default {
671-
plugins: {
672-
tailwindcss: {},
673-
autoprefixer: {},
674-
},
675-
}
676-
```
677-
678-
Write `app/style.css`:
655+
Write `app/style.css`, you must set the base path for source detection explicitly:
679656
680657
```css
681-
@tailwind base;
682-
@tailwind components;
683-
@tailwind utilities;
658+
@import "tailwindcss" source("../app");
684659
```
685660
686661
Import it in a renderer file. Using the `Link` component will refer to the correct CSS file path after it is built.
@@ -710,6 +685,7 @@ Finally, add `vite.config.ts` configuration to output assets for the production.
710685
import honox from 'honox/vite'
711686
import { defineConfig } from 'vite'
712687
import build from '@hono/vite-build/cloudflare-pages'
688+
import tailwindcss from '@tailwindcss/vite'
713689

714690
export default defineConfig({
715691
plugins: [
@@ -719,6 +695,7 @@ export default defineConfig({
719695
},
720696
}),
721697
build(),
698+
tailwindcss(),
722699
],
723700
})
724701
```

0 commit comments

Comments
 (0)