# Master CSS > A CSS language and framework for rapidly building beautiful websites and design systems with rule-based CSS-in-class. --- # Master CSS Vite: one plugin for every rendering mode Source: https://rc.css.master.co/en/blog/bootstrapping-master-css-with-vite Summary: A cleaner Vite integration for runtime rendering, static rendering, pre-rendering, and progressive rendering. Vite is one of the best foundations for modern frontend work: fast startup, predictable module graph, first-class plugins, and a build pipeline that is easy to extend without making the application feel heavy. `@master/css.vite` brings Master CSS into that pipeline as a first-class Vite integration. Instead of choosing between several setup guides, manual runtime imports, scanning scripts, and HTML post-processing steps, you install one plugin and choose the rendering model that matches your application. The goal is simple: keep Master CSS authoring as direct as markup, while letting Vite own the integration work. --- ## One plugin, four rendering modes The original Vite integration focused on Static Rendering. It worked well for projects that wanted a compiled stylesheet, but the rest of the Master CSS rendering story still required manual setup. The new `@master/css.vite` plugin unifies the modes behind one entry point: - `runtime`: injects the Master CSS runtime and config so styles can be generated in the browser. - `static`: wires Master CSS stylesheet imports into the static rendering workflow. - `pre-render`: renders HTML output and injects the CSS needed by those documents. - `progressive`: combines pre-rendered first-response CSS with the runtime engine for dynamic UI. That matters because not every Vite app has the same shape. A design system playground, a documentation site, a SPA, and a partially pre-rendered app should not be forced into the same CSS delivery strategy. Master CSS now lets the Vite project choose. --- ## Install it If you don't have a project yet, create one using `npm create vite@latest my-app`. ```bash action=install @master/css.vite@rc ``` Then register the plugin: ```js name=vite.config.js import { defineConfig } from 'vite' import masterCSS from '@master/css.vite' // [!code highlight] export default defineConfig({ plugins: [ masterCSS() // [!code highlight] ] }) ``` By default, the plugin uses `runtime` mode. That is the most forgiving way to start: Master CSS reads classes in the browser, generates the required rules, and keeps working as your UI changes. Run the Vite dev server and start writing Master CSS classes: ```bash action=run dev ``` --- ## Choose the right mode ### Runtime Use runtime mode when you want the simplest integration and maximum flexibility. It is a strong default for SPAs, prototypes, internal tools, and applications where classes can appear after hydration. ```js name=vite.config.js import { defineConfig } from 'vite' import masterCSS from '@master/css.vite' export default defineConfig({ plugins: [ masterCSS() ] }) ``` ### Static Rendering Use static mode when your classes are visible in source and you want a compiled CSS asset before runtime. This is the closest mode to traditional utility-first build workflows. ```js name=vite.config.js import { defineConfig } from 'vite' import masterCSS from '@master/css.vite' export default defineConfig({ plugins: [ masterCSS({ mode: 'static' }) ] }) ``` ### Pre-rendering Use pre-render mode when Vite emits HTML that can be styled before the browser runs JavaScript. The plugin renders the matching CSS and injects it into the document. For rendered pages, the critical CSS stays inline in `style#master-css`. The page hydration manifest is externalized as a hashed JSON asset and referenced from `data-master-css-hydration-manifest`, so the HTML does not grow with the runtime handoff data. ```js name=vite.config.js import { defineConfig } from 'vite' import masterCSS from '@master/css.vite' export default defineConfig({ plugins: [ masterCSS({ mode: 'pre-render' }) ] }) ``` ### Progressive Rendering Use progressive mode when you want the first HTML response to carry the CSS it needs, while the runtime continues to support client-only state, late-rendered components, and dynamic UI. ```js name=vite.config.js import { defineConfig } from 'vite' import masterCSS from '@master/css.vite' export default defineConfig({ plugins: [ masterCSS({ mode: 'progressive' }) ] }) ``` This is the mode that best represents the Master CSS rendering model: render what can be known early, keep the runtime for what becomes known later. In progressive mode, the runtime imports the page hydration manifest as a JSON module when it starts. Do not add a preload hint for that JSON file: the browser can already paint from `style#master-css`, and the manifest is only needed for the runtime to adopt those rules instead of rebuilding them. --- ## What the plugin handles `@master/css.vite` is not just a wrapper around an import. It participates in the Vite pipeline: - resolves the compiled MasterCSSManifest as a virtual module; - detects common Vite entry modules; - keeps the default stylesheet as an explicit `@import "@master/css"` in app CSS; - injects the runtime where runtime behavior is enabled; - handles static rendering output; - pre-renders HTML when the selected mode requires it; - externalizes page hydration manifests for pre-rendered and progressive HTML; - applies FOUC avoidance for runtime-first rendering. That is the difference between "Master CSS works in a Vite app" and "Master CSS feels like a Vite-native tool." --- ## Built for Vite-powered frameworks Vite is also the build foundation for many frameworks. `@master/css.vite` is the lower-level integration that makes the core Vite workflow work well, while framework packages can provide a more native setup when the framework has its own conventions. [Nuxt](/guide/installation/nuxtjs) uses a module: ```ts name=nuxt.config.ts export default defineNuxtConfig({ modules: [ '@master/css.nuxt' // progressive by default [!code highlight] // ['@master/css.nuxt', { mode: 'static' }] // ['@master/css.nuxt', { mode: 'runtime' }] // ['@master/css.nuxt', { mode: 'pre-render' }] ] }) ``` [Astro](/guide/installation/astro) uses an integration: ```ts name=astro.config.ts import masterCSS from '@master/css.astro' export default defineConfig({ integrations: [ masterCSS() // 'progressive' [!code highlight] // masterCSS({ mode: 'static' }) ] }) ``` --- ## A better default for Vite projects The value of this release is not only that setup is shorter. It is that the rendering strategy is now explicit and local to the Vite config. Start with runtime mode when you want speed and flexibility. Move to Static Rendering when your class graph is source-visible and you want compiled CSS. Use Pre-rendering when the HTML is already available at build time. Choose Progressive Rendering when you want the first page response to be styled early without giving up runtime behavior. That is the kind of choice a build tool should enable: one integration, multiple delivery strategies, and no extra application code when you change modes. For full setup details, see the [Vite installation guide](/guide/installation/vite) and the [rendering modes guide](/guide/rendering-modes). --- # Introducing the Master CSS Next.js Source: https://rc.css.master.co/en/blog/master-css-next Summary: The Next.js Adapter brings Progressive Rendering into the build pipeline, with Turbopack support for Static Rendering. Today we are introducing `@master/css.next`, the official Master CSS integration for Next.js. The headline is Progressive Rendering through the Next.js Adapter API. The adapter plugs into the Next.js build pipeline, receives the final static and pre-rendered HTML outputs, renders the Master CSS rules each document needs, and writes them back into the page as `