Config file
Project-level overrides for Weevar.
File names#
Weevar looks for, in order:
weevar.config.jsonweevar.config.mjsweevar.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:
- Inline
<Weevar config={...} />prop - JS / MJS config (
weevar.config.mjsfirst, thenweevar.config.js) - JSON config (
weevar.config.json) - 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.