The Tokenami CLI provides commands to initialize your project, generate stylesheets, and validate token usage.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tokenami/tokenami/llms.txt
Use this file to discover all available pages before exploring further.
Installation
The CLI is included with thetokenami package:
Available Commands
The CLI provides three main commands:init- Initialize Tokenami in your projectcheck- Validate token usage and type safety- Default command - Generate CSS stylesheet from token usage
Default Command (Generate)
Generate a CSS stylesheet from your token usage.Usage
Arguments
Glob pattern for files to include. Overrides
include from config.Options
Path to a custom config file.Default:
./tokenami.config.{ts,js}Output path for the generated CSS file.Default:
public/tokenami.cssWatch for file changes and rebuild automatically.
Minify the generated CSS output.
Examples
Basic Generation
Generate CSS using config file settings:With Custom Config
Use a custom config file:Custom Output Path
Generate CSS to a specific location:Watch Mode
Continuously watch for changes and regenerate:Minified Production Build
Generate minified CSS for production:Override Include Pattern
Scan specific files instead of using config:Watch with Custom Config and Minify
Combine multiple options:How It Works
The CLI:- Loads Configuration: Reads your
tokenami.config.{ts,js}file - Scans Files: Uses
includepatterns to find all files using tokens - Extracts Tokens: Parses token properties and values from your code
- Generates CSS: Creates a CSS file with:
- CSS custom properties for your theme
- Responsive variants
- Selector variants
- Global styles
- Keyframe animations
- Component styles from
css.compose()
- Optimizes Output: Processes with Lightning CSS for browser compatibility
- Writes File: Outputs the final CSS to the specified path
Generated CSS Structure
The generated CSS follows this structure:Including the CSS
After generation, include the CSS in your application:HTML
Next.js
app/layout.tsx
Vite
src/main.tsx
Remix
app/root.tsx
CI/CD Integration
Integrate into your build pipeline:package.json Scripts
Pre-commit Hook
package.json
Environment Variables
The CLI respects these environment variables:NODE_ENV- Affects browserslist target selectionBROWSERSLIST_ENV- Override browserslist environment
Performance
The CLI is optimized for large codebases:- Fast scanning: Uses
fast-globfor file discovery - Parallel processing: Processes files concurrently
- Smart caching: Only rebuilds when files change in watch mode
- Lightning CSS: Uses Rust-based CSS processing for speed
- Small project (under 100 files): ~1s
- Medium project (100-500 files): 1-3s
- Large project (500+ files): 3-10s
Troubleshooting
Config Not Found
No Tokens Found
TypeScript Config Errors
Related
tokenami init- Initialize Tokenamitokenami check- Validate token usage- Config Options - Configuration reference