@yummacss/vite

Generate CSS through Vite.

Usage

  1. 1

    Install the Plugin

    pnpm add -D @yummacss/vite
    
  2. 2

    Register It

    Add the plugin to your Vite configuration.

    vite.config.ts
    import { defineConfig } from "vite";import yummacss from "@yummacss/vite";
    export default defineConfig({ plugins: [yummacss()],});
  3. 3

    Add the Marker

    Put @yummacss; in your CSS entry file. The plugin replaces it with the generated CSS.

    src/styles.css
    @yummacss;
    

    Installation walks through the whole setup, including the config file.

Options

OptionTypeDefaultDescription
configConfigInline configuration. When provided, no config file is read.
configPathstringyumma.config.mjsPath to the config file.

Passing config inline is useful when the configuration has to be computed, such as a monorepo package that derives its source globs from its own location:

vite.config.ts
import { defineConfig } from "vite";
import yummacss from "@yummacss/vite";

export default defineConfig({
  plugins: [
    yummacss({
      config: { source: ["./src/**/*.tsx"] },
    }),
  ],
});