@yummacss/postcss

Generate CSS through PostCSS.

The PostCSS plugin, for Next.js & anything else with PostCSS in its pipeline. It works through Turbopack & Webpack alike, since both go through the same built-in PostCSS support.

Usage

  1. 1

    Install the Plugin

    pnpm add -D @yummacss/postcss
    
  2. 2

    Register It

    Add the plugin to your PostCSS configuration. It works through Turbopack & Webpack alike.

    postcss.config.mjs
    export default {  plugins: {    "@yummacss/postcss": {},  },};
  3. 3

    Add the Marker

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

    globals.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.
cwdstringprocess.cwd()Directory to resolve the config file & source globs from.

cwd is the one option the Vite plugin does not have. PostCSS is often run from a directory other than the project root, and the source globs are relative to the config file rather than to wherever the process started:

postcss.config.mjs
export default {
  plugins: {
    "@yummacss/postcss": { cwd: import.meta.dirname },
  },
};