Weevarv1.0.2

Config file

Project-level overrides for Weevar.

File names#

Weevar looks for, in order:

  1. weevar.config.json
  2. weevar.config.mjs
  3. weevar.config.js

JSON is the simplest. JS / MJS lets you compute values dynamically. If both exist, the JS file is treated as an overlay on the JSON file (deep-merged, JS wins on overlap).

The lookup is rooted at your project's cwd (i.e. wherever you run vite).


Schema#

type WeevarRuntimeConfig = {
  prompts?: WeevarPromptConfig;
};

type WeevarPromptConfig = {
  /** When true, prompts include parent class strings verbatim (Tailwind-friendly). */
  tailwindVerbatimClasses?: boolean;

  /** Tailwind `content` globs, used as prompt context. */
  tailwindContentGlobs?: string[];

  /** Path to your tailwind config file, used as prompt context. */
  tailwindConfigPath?: string;
};

Examples#

JSON#

{
  "prompts": {
    "tailwindVerbatimClasses": true
  }
}

This is the config the Weevar playground ships with.

JS#

// weevar.config.js
export default {
  prompts: {
    tailwindVerbatimClasses: process.env.NODE_ENV === "development",
  },
};

MJS#

// weevar.config.mjs
export default {
  prompts: { tailwindVerbatimClasses: true },
};

Precedence#

For any given runtime field, the value used is the first one set in this list:

  1. Inline <Weevar config={...} /> prop
  2. JS / MJS config (weevar.config.mjs first, then weevar.config.js)
  3. JSON config (weevar.config.json)
  4. Tailwind probe (only fills in fields not already set)

The Vite plugin computes the merged result at startup and exposes it via the virtual:weevar-config module. Other bundlers don't currently auto-load the file; pass the relevant fields via the component prop instead.