Replies: 1 comment
-
|
I got it working without hono-tailwind. These are the relevant dependencies I'm using: "dependencies": {
"@hono/node-server": "1.19.9",
"@tailwindcss/vite": "4.1.18",
"hono": "4.11.9",
"tailwindcss": "4.1.18"
},
"devDependencies": {
"@hono/vite-dev-server": "0.25.0",
"tsx": "4.21.0",
"typed-htmx": "0.3.1",
"typescript": "5.9.3",
"vite": "7.3.1"
},I followed the steps to install tailwind using vite and added |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When integrating preprocessors like Tailwind into Hono, most discussions end with "use Vite". Vite is an incredible bundler, and the hot module reloading that hono-dev-server provides is really useful. However, it's there are some shortcomings and confusing aspects about this relationship.
Environment variables
Vite loads environment variables from
.env,.env.local,.env.production, etc. It only accepts variables prefixed withVITE_to prevent sensitive system variables from leaking into the context.However, these variables don't appear to be passed to
hono-dev-serverand instead need to be explicitly loaded in thevite.config.ts, passed to thedevServer()plugin initializer, and also monkey patched intoprocess.env.honojs/vite-plugins#258
vite.config.ts
Accessing bundled assets
If you want to use a preprocessor like Tailwind, it is unclear where the assets will go or how to access them from the bundle. The best example I could find was this article and it does not address how to get it working with the dev server, only build and preview.
My current workaround is to use the bare bones hono-tailwind which compiles the CSS and serves it as a static asset route.
Beta Was this translation helpful? Give feedback.
All reactions