Getting Started
Project setup
Let croff init configure your project.
The fastest way to configure a project is the CLI:
bash
croff initWhat init does
It looks at your project, then:
- Detects your build tool, framework and whether you use TypeScript, from
package.jsonand config files. - Creates
croff.config.ts, orcroff.config.mjsif you don't use TypeScript. - Creates a stylesheet with the
@croffdirective, atsrc/croff.cssif you have asrcdirectory. - Wires up the integration:
- Vite: adds the plugin to your Vite config. If it can't confidently edit the file, it tells you what to add.
- PostCSS or Next.js: creates a
postcss.config.mjs, or tells you what to add to your existing one. - Neither: sets
inputandoutputin the config, for use withcroff devandcroff build.
- Prints the remaining steps.
init never overwrites a file. Run it with --dry-run to preview what it would do, or --integration vite, postcss or cli to override detection.
What you get
ts
import { defineConfig } from "@croff/core";
export default defineConfig({
content: ["src/**/*.{html,js,jsx,ts,tsx,vue,svelte,astro,md,mdx}", "index.html"],
theme: {
colors: {
// Your tokens are merged over the default theme.
// brand: "#c8fd12",
},
},
});css
@croff reset;
@croff;@croff reset; adds a small reset and is optional. @croff; adds your theme variables and utilities. See Configuration file for every option.
