The config file
Where the config lives, how every tool finds it, and how one file feeds the build, the CLI and the runtime.
One file, three consumers#
nibcss.config.ts at the project root is read by:
- the build plugin (
@nibcss/unplugin,@nibcss/next,@nibcss/nuxt), - the CLI (
@nibcss/cli), - the runtime, through the generated
@nibcss/configmodule.
Tokens, recipes and diagnostics therefore behave identically at build time and in the browser.
File names#
Searched in this order at the project root:
nibcss.config.ts → .mts → .js → .mjs → .cjs → the same with nib.config.
Point elsewhere with the plugin's config option or the CLI's --config flag.
Shape#
import { defineConfig } from "@nibcss/core";
export default defineConfig({
darkMode: "class",
debug: true,
tokens: { color: { brand: "#4F52D9" } },
components: { btn: "p=8px 16px; bdrd=8px" },
});defineConfig only adds types — it returns the object unchanged.
Sharing the config with the runtime#
import config from "@nibcss/config";
<NibProvider {...config}>…</NibProvider>When changes apply#
Tool | Picks up config edits |
|---|---|
Vite plugin | immediately, with HMR |
| on the next rebuild |
webpack / Next.js | normally on the next compile — if a new recipe is still reported as unknown, restart the dev server |
CDN runtime | on reload, or live with |
Missing or empty config#
Two situations are always reported, even without debug: no config file at all, and a config that exports
nothing (commented out, or missing export default). Everything else still works without a config.