# css_subset

URL: https://lbliii.github.io/chirp-ui/api/css_subset/
Section: api
Description: Manifest-driven CSS subset selection for chirp-ui (issue #205).

The shipped ``chirpui.css`` concatenates every authoring partial (~350+
components). Consumers that use a handful of macros can emit a **fraction** of
that payload by naming the components they import.

Mapping strategy: each `ComponentDescriptor` declares
a BEM ``block``; the subset resolver finds partials whose CSS defines the root
class ``.chirpui-\{block}``. Foundation partials (tokens, reset, base, layout)
and utility partials are always included so a subset remains usable.

Pure stdlib — no I/O in `resolve_partial_paths`(); the build script reads files.

---

> For a complete page index, fetch https://lbliii.github.io/chirp-ui/llms.txt.

Manifest-driven CSS subset selection for chirp-ui (issue #205).

The shipped`chirpui.css`concatenates every authoring partial (~350+
components). Consumers that use a handful of macros can emit a fraction of
that payload by naming the components they import.

Mapping strategy: each`ComponentDescriptor`declares
a BEM`block`; the subset resolver finds partials whose CSS defines the root
class`.chirpui-\{block}`. Foundation partials (tokens, reset, base, layout)
and utility partials are always included so a subset remains usable.

Pure stdlib — no I/O in`resolve_partial_paths`(); the build script reads files.

css_subset

Name

Type

Default

Description

`type`

``

—

`qualified_name`

``

—

`element_type`

``

—

`description`

``

—

`source_file`

``

—

`line_number`

``

—

`is_autodoc`

``

—

`autodoc_element`

``

—

`_autodoc_template`

``

—

`_autodoc_url_path`

``

—

`_autodoc_page_type`

``

—

`title`

``

—

`doc_content_hash`

``

—

## Symbols on this page

function
css_partial_root

Return the authoring partials directory.

Jump to symbol

(#css_partial_root)

function
validate_component_names

Normalize and validate component names against the registry.

Raises`KeyError`with suggestions when a name is unknown.

Jump to symbol

(#validate_component_names)

function
resolve_partial_paths

Return ordered partial paths for a component subset.

Order follows numeric filename prefix (cascade order), same as the full build.

Jump to symbol

(#resolve_partial_paths)

class
CssSubsetPlan

Resolved subset plan with size diagnostics.

Jump to symbol

(#CssSubsetPlan)

css_partial_root

function

```
def css_partial_root() -> Path
```

Return the authoring partials directory.

No parameters.

validate_component_names

function

```
def validate_component_names(names: Sequence[str]) -> tuple[str, ...]
```

Normalize and validate component names against the registry.

Raises`KeyError`with suggestions when a name is unknown.

Parameters

Name

Type

Default

Description

`names`

`Sequence[str]`

—

resolve_partial_paths

function

```
def resolve_partial_paths(components: tuple[str, ...], *, include_utilities: bool = True) -> tuple[str, ...]
```

Return ordered partial paths for a component subset.

Order follows numeric filename prefix (cascade order), same as the full build.

Parameters

Name

Type

Default

Description

`components`

`tuple[str, ...]`

—

`include_utilities`

`bool`

`True`

CssSubsetPlan

class

Resolved subset plan with size diagnostics.

View source · /home/runner/work/chirp-ui/chirp-ui/site/../src/chirp_ui/css_subset.py:1
(https://github.com/lbliii/chirp-ui/blob/main//home/runner/work/chirp-ui/chirp-ui/site/../src/chirp_ui/css_subset.py#L1)
