Skip to content

Introduction

Architecture

How the packages fit together.

CROFF is a pipeline of small packages, each independently tested.

text
 source files ──► scanner ──► candidates ──┐
                                           ▼
 croff.config ──► core ──► theme + registry ──► compiler ──► CSS + diagnostics
                    ▲                             │
                 plugins                          ├─ parser   (syntax → AST)
                                                  └─ registry (AST → declarations)

Packages

PackageResponsibility
@croff/parserTokenizer, parser and AST. Knows nothing about utilities or themes.
@croff/themeToken scales, merging, validation, CSS variables and the default theme.
@croff/registryUtility and variant definitions, and turning an AST into declarations.
@croff/compilerCaching, ordering, selectors, printing and source maps.
@croff/scannerFinding expressions in text, and scanning and watching files.
@croff/plugin-apiThe plugin interface and its validation.
@croff/coreThe public API. @croff/core/node adds config loading and projects.
@croff/cliThe croff command.
@croff/viteThe Vite plugin.
@croff/postcssThe PostCSS plugin.

Most projects only touch @croff/core and one integration.

Browser-safe by construction

@croff/core and @croff/scanner/extract have no Node dependencies. The playground imports exactly those two entry points, so it runs the same compiler as your build.

Separation of stages

Parsing doesn't depend on configuration: gap(4 is a syntax error under any theme. Resolution checks names and values. Printing only sees finished rules. See Compiler architecture for a closer look.