@sobagu/compiler
v0.1.2
Published
Build-time CSS for Sobagu CSS: one plugin for Vite, Rollup, webpack, esbuild and Rspack
Maintainers
Readme
@sobagu/compiler
Build-time CSS for Sobagu. One plugin for Vite, Rollup, webpack, esbuild and Rspack that finds the styles in your code and writes them to a real CSS file at build time, so the page is styled on first paint and SSR needs no extra step. Values it can't see at build time still work: the small runtime adds them, and never injects a class twice.
Install
npm i -D @sobagu/compilerRuns on Node 22.18+ or 24.11+.
Usage
// vite.config.ts
import sobagu from '@sobagu/compiler/vite'
export default { plugins: [sobagu()] }// your entry file (main.tsx / main.ts)
import 'virtual:sobagu.css'webpack, Rspack, Rollup and esbuild:
import sobagu, { rspack, rollup, esbuild } from '@sobagu/compiler/webpack'
// webpack: config.plugins.push(sobagu()) Rspack: config.plugins.push(rspack())
// Rollup: plugins: [rollup()] esbuild: plugins: [esbuild()]// entry file: the plain name works everywhere, and webpack needs it ("virtual:" is a URL scheme to webpack)
import 'sobagu.css'Next.js builds with Turbopack by default, which the compiler doesn't support yet: use Next.js in webpack mode
(next build --webpack), or skip the compiler (runtime styles + getCssText() for SSR).
Docs
- Build-time CSS (compiler): what it finds, options and SSR
Sobagu is in 0.x: the API can still change between minor versions.
Licence
MIT © 2026 Sobagu contributors
