Loading...
Loading...
Two features land in this update: typed environment variables and opt-in Lightning CSS. One tightens the boundary between your config and your code; the other speeds up how Ossido processes your CSS.
Environment config has always been stringly-typed and easy to get wrong - a missing
variable surfaces as a runtime undefined deep inside a request. Ossido now lets
you declare a single, typed source of truth: an Environment struct in Rust. Its
fields are parsed and validated from the OS environment at startup, and the
ones you mark #[public] are exposed to the frontend with generated TypeScript
types.
A required field that is missing or unparseable panics at startup with the
offending variable name, so a bad config fails loudly on boot instead of three
screens into a request. Read any field in Rust with the get_env! macro:
On the frontend, only #[public] fields are available, fully typed from the
generated .ossido/types.ts:
A second argument to get_env! or getEnv is a fallback that collapses an
Option<T> value to a concrete T. Secrets stay in Rust - only public fields are
serialized into the page, so a connection string can never leak into the client
bundle. The whole feature is optional: define no struct and nothing changes. Full
details in Environment Variables.
Ossido can now process CSS with Lightning CSS - a
fast, Rust-based transformer and minifier - in place of Vite's default PostCSS
pipeline. It's opt-in; turn it on in ossido.config.ts:
That switches on the transformer in dev and build, and minification in the production build, using a sensible default set of browser targets. Point it at your own browserslist query when you need to:
You get autoprefixing and modern-CSS lowering (nesting, custom media, colour
functions) driven by those targets, minified production bundles, and CSS Modules
that keep working - all running in Rust instead of PostCSS + esbuild. Vite plugins
like @tailwindcss/vite are unaffected and compose cleanly. More in
Styling → Lightning CSS.
Both features are documented in full:
Bump the ossido crate and the @ossido-labs/ossido package to 0.1.4, and
update the CLI:
The full diff is in the 0.1.4 release notes (0.1.3...0.1.4).