css_generator.ts

The generator core the Vite plugin and the Gro generator share: the options both read with their defaults, the resources a render needs, and the render itself - from a collection of extracted classes to banner-free CSS, with its diagnostics dispatched per on_error and on_warning. Each generator owns only how it collects the classes and where the CSS goes.

view source

Declarations
#

3 declarations

create_css_generator
#

css_generator.ts view source

internal

The core both generators render through - not stable API.

(options: CssGeneratorBaseOptions, sink: DiagnosticSink): CssGenerator import {create_css_generator} from '@fuzdev/fuz_css/css_generator.js';

Creates the core a generator renders through.

options

the generator's options

sink

where logged diagnostics go

returns

CssGenerator

CssGenerator
#

css_generator.ts view source

internal

The core both generators render through - not stable API.

CssGenerator import type {CssGenerator} from '@fuzdev/fuz_css/css_generator.js';

A generator's shared core - see create_css_generator.

create_css_classes

Creates an empty class collection with the configured include and exclude classes.

type (): CssClasses

returns CssClasses

ensure_ready

Loads what a render needs - the CSS properties literal classes are validated against, and the bundled resources unless both base styles and theme variables are off. Loads once; safe to call any number of times, and a failed load is retried on the next call.

type (): Promise<void>

returns Promise<void>

render

Renders CSS without banners and dispatches its diagnostics. Before ensure_ready resolves it renders utility classes only.

type (input: CssRenderInput): string

input

returns string

throws

  • CssGenerationError - for a diagnostic level set to `'throw'`

CssRenderInput
#

css_generator.ts view source

internal

The core both generators render through - not stable API.

CssRenderInput import type {CssRenderInput} from '@fuzdev/fuz_css/css_generator.js';

What one render reads: the classes extracted so far and the var() names scanned from source.

css_classes

type CssClasses

detected_css_variables

The var(--*) names referenced in source, unfiltered - names that aren't theme variables are ignored.

type Iterable<string, any, any>

log?

A logger for resolution stats and custom interpreters.

type Logger

include_stats?

Whether to compute and log resolution statistics.

type boolean

Depends on
#

Imported by
#