Open ryuapp opened 7 months ago
Hi @ryuapp !
Thanks for the suggestion. I've implemented the feature of the Script
component to support it: #93. How about this?
Thank you, @yusukebe! Allow me to comment on just two points.
FOUC(flash of unstyled content) I save files or reload a screen every time, a flicker occurs on dev mode. Without this, the PR is a good DX.
Only Global Style?
I don't have a problem as long as I can easily import tailwindcss, but there may be times when we want to load a css file only on a specific page. Therefore, I think it's best to be able to import it within files of routes
directory.
Even with the current PR, that meets my demands!
Hi @ryuapp
Can you share the example using Tailwind CSS with this PR? I want to know the setting. Using PostCSS?
@ryuapp consider importing css this way
import styles from "../style.css?url"
export default jsxRenderer(async ({ title, children }) => {
return (
<html lang="en">
<head>
...
<link href={styles} rel="stylesheet" />
...
</head>
...
</html>
)
})
and updating your vite.config.ts
export default defineConfig(({ mode }) => {
if (mode === "client") {
return {
plugins: [client()],
}
}
return {
plugins: [honox(), pages()],
build: {
assetsDir: "static",
ssrEmitAssets: true,
},
}
})
@emmanuelchucks I prefer it to the current config. I currently use that config, but in the future I would like to configure it only with the import syntax. Thank you!
I'm trying to use Remix on Hono's Vite dev-server. In that app, it can support "css side-effects imports" which is a matter of this issue:
So, we may make it by referring to Remix.
What is the feature you are proposing?
Now, in order to use tailwindcss with HonoX, we need to configure it with vite and add link tags for dev and prod envs in head. This seems a bit troublesome.
It would be good if we could just import it as following:
If there is already a way to achieve this, please comment it.