css_plugin_options.ts

Shared options for CSS generation plugins (Gro and Vite).

Both gen_fuz_css (Gro generator) and vite_plugin_fuz_css share the same core options for extraction, generation, and bundled CSS. This module provides the shared types to ensure consistency.

Bundled mode (default)

By default, the generated CSS (virtual:fuz.css or ./fuz.css) includes only the content your code uses from all three layers: - Base styles (element defaults) - Theme variables (CSS custom properties) - Utility classes

undefined vs null Convention

Configuration options that accept both undefined and null follow this pattern:

- undefined - Use framework defaults. The feature is enabled with standard behavior. - null - Explicitly disable the feature. No output is generated for that layer.

This applies to BaseCssOption and VariablesOption. Setting both to null enables "utility-only mode" where you manage your own theme and base styles via direct imports (@fuzdev/fuz_css/style.css and theme.css, which include all content).

Declarations
#

8 declarations

view source

BaseCssOption
#

css_plugin_options.ts view source

BaseCssOption

Type for the base_css option used by CSS generators.

Supports four forms: - undefined - Use default style.css (framework defaults) - null - Disable base styles entirely (explicit opt-out) - string - Custom CSS to replace defaults - (default_css) => string - Callback to modify default CSS

See module documentation for the undefined vs null convention.

CssCacheOptions
#

css_plugin_options.ts view source

CssCacheOptions

Options for cache behavior.

cache_dir

Cache directory relative to project root.

type string

deps

Filesystem deps for cache management. Defaults to production implementation. Override for testing.

CssClassOptions
#

css_plugin_options.ts view source

CssClassOptions

Options for CSS class definitions and interpretation. Controls how classes are defined and how dynamic classes are generated.

class_definitions

Additional class definitions to merge with defaults. User definitions take precedence over defaults with the same name. Required when include_default_classes is false.

type Record<string, CssClassDefinition | undefined>

include_default_classes

Whether to include default class definitions (token and composite classes). When false, class_definitions is required.

type boolean

class_interpreters

Custom interpreters for dynamic class generation. Replaces the builtin interpreters entirely if provided.

type Array<CssClassDefinitionInterpreter>

CssDiagnosticsOptions
#

css_plugin_options.ts view source

CssDiagnosticsOptions

Options for error and warning handling.

on_error

How to handle CSS-literal errors during generation. - 'log': Log errors, skip invalid classes, continue - 'throw': Throw on first error, fail the build

type 'log' | 'throw'

on_warning

How to handle warnings during generation. - 'log': Log warnings, continue - 'throw': Throw on first warning, fail the build - 'ignore': Suppress warnings entirely

type 'log' | 'throw' | 'ignore'

CssExtractionOptions
#

css_plugin_options.ts view source

CssExtractionOptions

Options for CSS class extraction from source files. Controls which files to scan and how to parse them.

filter_file

Filter function to determine which files to extract classes from. By default, extracts from .svelte, .html, .ts, .js, .tsx, .jsx files, excluding test files and .gen files.

acorn_plugins

Additional acorn plugins for parsing. Use acorn-jsx for React/Preact/Solid projects.

type Array<AcornPlugin>

CssGeneratorBaseOptions
#

CssOutputOptions
#

css_plugin_options.ts view source

CssOutputOptions

Options for CSS output generation (theme + base + utilities). Controls how the three CSS layers are combined.

base_css

Base styles (element defaults) configuration. - undefined (default): Use default style.css - null: Disable base styles entirely - string: Custom CSS to replace defaults - (default_css) => string: Callback to modify default CSS

variables

Theme variables configuration. - undefined (default): Use default variables from fuz_css - null: Disable theme entirely - Array<StyleVariable>: Custom variable definitions (replaces defaults) - (defaults) => Array<StyleVariable>: Callback to modify default variables

theme_specificity

Specificity multiplier for theme CSS selectors. Defaults to 1 which generates :root, higher values generate more specific selectors (e.g., :root:root).

type number

additional_classes

Classes to always include in the output, regardless of detection. Useful for dynamically generated class names that can't be statically extracted.

type Iterable<string>

additional_elements

Additional HTML elements to always include base styles for. Use 'all' to include all base styles regardless of detection. Useful for elements generated at runtime via document.createElement().

type Iterable<string> | 'all'

additional_variables

Additional CSS variables to always include in theme output. Use 'all' to include all theme variables regardless of detection. Useful for variables referenced dynamically.

type Iterable<string> | 'all'

exclude_classes

Classes to exclude from the output, even if detected. Useful for filtering out false positives from extraction.

type Iterable<string>

exclude_elements

Elements to exclude from base CSS output, even if detected. Useful for filtering out elements you don't want styles for.

type Iterable<string>

exclude_variables

CSS variables to exclude from theme output, even if referenced. Useful for filtering out variables you don't want in the theme.

type Iterable<string>

VariablesOption
#

css_plugin_options.ts view source

VariablesOption

Type for the variables option used by CSS generators.

Supports four forms: - undefined - Use default variables (framework defaults) - null - Disable theme generation entirely (explicit opt-out) - Array<StyleVariable> - Custom variables array (replaces defaults) - (defaults) => Array<StyleVariable> - Callback to modify defaults

See module documentation for the undefined vs null convention.