Use typescriptcss alongside PostCSS
typescriptcss is a zero-runtime CSS-in-JS library. You write styles as inline chains directly on your elements, and the build plugin collects them into a stylesheet with hashed class names.
typescriptcss does not currently ship a standalone PostCSS plugin. Keep your PostCSS pipeline and add the adapter for the bundler that runs it; this example uses Vite.
Install typescriptcss
Install the runtime and the Vite adapter. Your existing PostCSS plugins can stay in postcss.config.mjs.
Add the plugin to your config
Register typescriptcss at the bundler layer. Vite continues to pass the emitted CSS through your existing PostCSS configuration.
Write your styles inline
Import the utilities you need and build a chain, then call it to produce the style object. No class names or separate CSS file are required.
Compose states and breakpoints
Insert dark, sm, md, or lg anywhere in the chain to scope the styles after it. Everything stays in the same expression.
Run the build
Run the normal Vite build. typescriptcss emits CSS first, and your configured PostCSS pipeline processes the build output.