GUIDES

Rolldown

Add Plumeria to a Rolldown project, with one command or by hand.

examples/example-rolldown shows how to use @plumeria/unplugin in Rolldown.
The plugin compiles Plumeria styles into the CSS asset Rolldown produces.

npx @plumeria/init detects Rolldown and writes this setup for you; see @plumeria/init. The rest of this page is the same setup by hand.

Installation

Terminal
pnpm i -D @plumeria/unplugin

Usage

rolldown.config.js
import { defineConfig } from 'rolldown';
import plumeria from '@plumeria/unplugin';
import postcss from 'rollup-plugin-postcss';

export default defineConfig({
  input: 'src/index.tsx',
  output: {
    dir: 'dist',
  },
  moduleTypes: {
    css: 'empty',
  },
  plugins: [plumeria.rolldown(), postcss({ extract: true })],
});

plumeria.d.ts

@plumeria/core ships no prop declaration of its own, so name the styling prop your project compiles with.

For the default name (classStyle), reference the declaration that ships with the package, in src/ when the project has one or at the application root otherwise:

plumeria.d.ts
/// <reference types="@plumeria/core/class-style" />

If you set a custom styleProp (such as 'sx'), declare that name instead, and keep it the same as the one passed to the plugin; see Declaring the styling prop.

Edit on GitHub

On this page