-
Notifications
You must be signed in to change notification settings - Fork 88
Description
What is the feature you are proposing?
When implementing features like color scheme switching (e.g., light/dark mode) with HonoX, a common issue is that the default theme is applied until an external .js file finishes loading, causing a brief flash of the wrong theme on page load. This is known as FOUC (Flash of Unstyled Content). A widely adopted solution is to embed the color scheme logic as an inline script directly in the delivered HTML, ensuring the correct theme is applied before the page is rendered.
Inline scripts are useful not only for color scheme handling but also for other scenarios, such as injecting initial state, CSP nonce-based initialization, or analytics snippets that must run as early as possible.
For reference, Astro provides a directive for inserting inline scripts1.
I believe it would be helpful if HonoX offered a simple helper component, such as <InlineScript/>, to make embedding inline scripts more convenient and ergonomic.