Loading...
Loading...
Ossido leaves styling to Vite, so anything Vite supports works out of the box: a global stylesheet, CSS Modules, preprocessors, and Tailwind.
Scaffold with --tailwind (or pick it in the wizard) to get Tailwind
preconfigured:
That wires up two things. First, the @tailwindcss/vite plugin in
ossido.config.ts:
Second, a global stylesheet that pulls Tailwind in (Tailwind v4 style):
From there it's ordinary Tailwind - add @theme, @plugin, or @custom-variant
directives in that stylesheet as needed.
Global styles live in a plain .css file - src/styles/global.css by convention
Because the import sits in the root layout, the stylesheet applies to every route. Import it once there rather than per page.
Everything Vite does with CSS is available. Import a stylesheet for its side
effects, or a *.module.css file for locally-scoped class names:
Preprocessors (Sass, Less, ...) work once you install them and use the matching
extension. To fine-tune CSS handling - CSS Modules class naming, preprocessor
options - use the vite.css option in ossido.config.ts (it takes Vite's
standard CSSOptions).
Ossido can process CSS with Lightning CSS - a fast,
Rust-based transformer and minifier - in place of Vite's default PostCSS pipeline.
It's opt-in and off by default. Turn it on in ossido.config.ts:
That enables the transformer (dev and build) and the minifier (production build), using a sensible default set of browser targets.
Lightning CSS uses browser targets to decide what to autoprefix and which modern
CSS features to lower. Override the default ('defaults') with a
browserslist query:
The query is used verbatim - a project's .browserslistrc or package.json
browserslist field is not consulted.
*.module.css) - class names are scoped and
hashed by Lightning CSS, and stay consistent between the emitted CSS and the
server-rendered markup.postcss.config.js
(autoprefixer and the like) is ignored - prefixing comes from your targets
instead.@tailwindcss/vite (Tailwind v4)
run as plugins, not through the CSS transformer, so they compose cleanly with it.Next: MDX · Back to React frontend