Use plain CSS in Bini.js - import only what you need, where you need it.
Bini.js works with plain .css files out of the box. Import a .css file and it loads. This page covers plain CSS only.
Or run the interactive prompt and choose None for styling:
Put base styles, resets, and variables in a global stylesheet. Import it once in your root layout:
Import CSS in the route that needs it. That way, pages that do not use the styles never load them. Each route can have its own stylesheet:
/ will not download dashboard/page.css. Import CSS in the page or layout that uses it.When a layout imports a stylesheet, that CSS applies only to routes inside the layout's folder. Here, blog.css is imported in the blog layout:
blog.css imported in src/app/blog/layout.tsx, only pages under /blog load it. If you import it in the root layout instead, every page loads it.Keep a plain .css file next to a reusable component. You do not need CSS Modules for this. Just use clear class names so styles do not clash:
.module.css). With plain CSS, prefix your class names: btn-, card-, and so on.When you import CSS from an npm package, put the import in the route that uses it:
CSS applies in the order you import it. Keep a consistent order so later rules override earlier ones the way you expect:
CSS variables let you define a value once and reuse it everywhere. Define them in global CSS with :root, then read them with var(--name) in any rule:
Vite supports Sass once you install the sass package. Import a .scss file the same way you import a .css file:
If you prefer CSS-in-JS, install the library and use it in the components that need it:
Scoped class names with .module.css.
Utility-first styling with Tailwind.
Where to import CSS in the app directory.
Read env vars from Hono handlers.
Use plain CSS in Bini.js - import only what you need, where you need it.
Bini.js works with plain .css files out of the box. Import a .css file and it loads. This page covers plain CSS only.
Or run the interactive prompt and choose None for styling:
Put base styles, resets, and variables in a global stylesheet. Import it once in your root layout:
Import CSS in the route that needs it. That way, pages that do not use the styles never load them. Each route can have its own stylesheet:
/ will not download dashboard/page.css. Import CSS in the page or layout that uses it.When a layout imports a stylesheet, that CSS applies only to routes inside the layout's folder. Here, blog.css is imported in the blog layout:
blog.css imported in src/app/blog/layout.tsx, only pages under /blog load it. If you import it in the root layout instead, every page loads it.Keep a plain .css file next to a reusable component. You do not need CSS Modules for this. Just use clear class names so styles do not clash:
.module.css). With plain CSS, prefix your class names: btn-, card-, and so on.When you import CSS from an npm package, put the import in the route that uses it:
CSS applies in the order you import it. Keep a consistent order so later rules override earlier ones the way you expect:
CSS variables let you define a value once and reuse it everywhere. Define them in global CSS with :root, then read them with var(--name) in any rule:
Vite supports Sass once you install the sass package. Import a .scss file the same way you import a .css file:
If you prefer CSS-in-JS, install the library and use it in the components that need it:
Scoped class names with .module.css.
Utility-first styling with Tailwind.
Where to import CSS in the app directory.
Read env vars from Hono handlers.