Skip to content

Using CSS Forge

CLI Usage

Assuming you have added the script to your package.json, you can run CSS Forge like this :

bash
# Basic usage
pnpm run cssforge

# Watch mode
pnpm run cssforge -- --watch

# Custom paths and output 
pnpm run cssforge -- --config ./foo/bar/custom-path.ts --css ./dist/design-tokens.css --ts ./dist/design-tokens.ts --json ./dist/design-tokens.json --mode all

Programmatic Usage

You can also use CSS Forge programmatically:

typescript
import { generateCSS } from "jsr:@hebilicious/cssforge";

// Generate CSS string
const css = generateCSS(config);

Best Practices

  • Version Control: Commit your generated CSS files
  • CSS Layers: Use @layer to manage specificity
  • Config First: Always edit the config file, never edit the generated files

Released under the MIT License.