Skip to content

Commit

Permalink
docs: update TailwindCSS v4 guide (#261)
Browse files Browse the repository at this point in the history
* docs: update TailwindCSS v4 guide

* tweak
  • Loading branch information
ryuapp authored Feb 11, 2025
1 parent 39b4ea8 commit ba7279d
Showing 1 changed file with 5 additions and 28 deletions.
33 changes: 5 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -650,37 +650,12 @@ Like the followings:
### Using Tailwind CSS
Given that HonoX is Vite-centric, if you wish to utilize [Tailwind CSS](https://tailwindcss.com/), simply adhere to the official instructions.
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).
Prepare `tailwind.config.js` and `postcss.config.js`:
```js
// tailwind.config.js
export default {
content: ['./app/**/*.tsx'],
theme: {
extend: {},
},
plugins: [],
}
```
```js
// postcss.config.js
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
```
Write `app/style.css`:
Write `app/style.css`, you must set the base path for source detection explicitly:
```css
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss" source("../app");
```
Import it in a renderer file. Using the `Link` component will refer to the correct CSS file path after it is built.
Expand Down Expand Up @@ -710,6 +685,7 @@ Finally, add `vite.config.ts` configuration to output assets for the production.
import honox from 'honox/vite'
import { defineConfig } from 'vite'
import build from '@hono/vite-build/cloudflare-pages'
import tailwindcss from '@tailwindcss/vite'

export default defineConfig({
plugins: [
Expand All @@ -719,6 +695,7 @@ export default defineConfig({
},
}),
build(),
tailwindcss(),
],
})
```
Expand Down

0 comments on commit ba7279d

Please sign in to comment.