Manifest-driven CSS subset selection for chirp-ui (issue #205).
The shippedchirpui.cssconcatenates 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: eachComponentDescriptordeclares
a BEMblock; 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 inresolve_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
Return the authoring partials directory.
Normalize and validate component names against the registry.
RaisesKeyErrorwith suggestions when a name is unknown.
Return ordered partial paths for a component subset.
Order follows numeric filename prefix (cascade order), same as the full build.
Resolved subset plan with size diagnostics.
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.
RaisesKeyErrorwith 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