GUIDES

Webpack

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

examples/example-webpack shows how to use @plumeria/unplugin in Webpack.
The plugin compiles Plumeria styles into CSS, with HMR in development.

npx @plumeria/init detects Webpack 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

webpack.config.js
import plumeria from '@plumeria/unplugin';

export default { 
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader'],
      },
    ],
  },
  plugins: [ 
    plumeria.webpack(), 
  ],
};

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 (sx), 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/sx" />

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

Edit on GitHub