PresetCSS Docs v0.1.0
Search docs… ⌘K
GitHub

Installation

PresetCSS ships as a single static binary. No Node, no npm, no runtime dependencies.

💡

Rust required for cargo install

Install Rust from rustup.rs if you haven't already. Pre-built binaries will be available in a future release.

# Install from crates.io
cargo install presetcss

# Verify the install
presetcss --version

Init a preset

Run presetcss init in your project root to generate a commented preset.toml with sensible defaults.

# Create preset.toml in the current directory
presetcss init

# Or specify a path
presetcss init --output ./config/preset.toml

Build CSS

# Generate CSS from preset.toml
presetcss build

# Rebuild on file change
presetcss watch

Colors

Each key in [colors] generates three utility classes.

[colors]
primary = "#0284c7"
muted = "#64748b"

Generates:

.bg-primary
background-color: #0284c7
.text-primary
color: #0284c7
.border-primary
border-color: #0284c7
⚠️

Name collisions

Color names that clash with static utilities (like block or flex) will trigger a build error. Use presetcss validate to check before building.

Variants

Variants are opt-in per token group. Nothing is generated unless you ask for it.

[variants]
# Generate hover: and focus: classes for color tokens only
colors = ["hover", "focus"]
static = ["responsive"] # enables breakpoint:flex etc.
spacing = [] # no spacing variants
🚫

Variant explosion

Enabling all variants for all groups can multiply output size by 10x or more. Combine variants with content scanning to avoid shipping unused rules.

← Installation Spacing →