vite_plugin_fuz_css.ts

Vite plugin for fuz_css utility class generation.

Uses Vite's transform hook to extract CSS classes from source files as they're processed, including node_modules dependencies. Generates CSS on-demand via virtual module with HMR support.

@example ```ts // vite.config.ts import {defineConfig} from 'vite'; import jsx from 'acorn-jsx'; import {vite_plugin_fuz_css} from '@fuzdev/fuz_css/vite_plugin_fuz_css.js';

export default defineConfig({ plugins: [ vite_plugin_fuz_css({ acorn_plugins: [jsx()], }), ], }); ```

Declarations
#

3 declarations

view source

FUZ_CSS_MARKER
#

vite_plugin_fuz_css
#

vite_plugin_fuz_css.ts view source

(options?: VitePluginFuzCssOptions): Plugin$1<any>

Creates the fuz_css Vite plugin.

Extracts CSS classes from source files during Vite's transform phase and generates optimized CSS via the virtual:fuz.css virtual module.

options

default {}

returns

Plugin$1<any>

VitePluginFuzCssOptions
#

vite_plugin_fuz_css.ts view source

VitePluginFuzCssOptions

Options for the fuz_css Vite plugin.

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.

class_definitions

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

type Record<string, CssClassDefinition | undefined>

include_default_definitions

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>

include_classes

Classes to always include in the output, regardless of detection.

type Iterable<string>

exclude_classes

Classes to exclude from the output, even if detected.

type Iterable<string>

acorn_plugins

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

type Array<AcornPlugin>

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'

cache_dir

Cache directory relative to project root.

type string

Depends on
#