django_bird.staticfiles

Module Contents

Classes

Functions

register_asset_types

collect_component_assets

get_component_assets

Get assets for a component, optionally filtered by type.

Data

API

django_bird.staticfiles.logger

‘getLogger(…)’

class django_bird.staticfiles.AssetElement(*args, **kwds)

Bases: enum.Enum

STYLESHEET

‘stylesheet’

SCRIPT

‘script’

class django_bird.staticfiles.AssetType
element: django_bird.staticfiles.AssetElement

None

extension: str

None

tag: django_bird.templatetags.tags.asset.AssetTag

None

property suffix
django_bird.staticfiles.CSS

‘AssetType(…)’

django_bird.staticfiles.JS

‘AssetType(…)’

class django_bird.staticfiles.AssetTypes

Initialization

is_known_type(path: pathlib.Path) bool
register_type(asset_type: django_bird.staticfiles.AssetType) None
reset() None
django_bird.staticfiles.asset_types

‘AssetTypes(…)’

django_bird.staticfiles.register_asset_types(register_type: collections.abc.Callable[[django_bird.staticfiles.AssetType], None])
class django_bird.staticfiles.Asset
path: pathlib.Path

None

type: django_bird.staticfiles.AssetType

None

__hash__() int
exists() bool
render()
property absolute_path
property relative_path
property storage
property template_dir
property url: str | None
django_bird.staticfiles.collect_component_assets(template_path: pathlib.Path) collections.abc.Iterable[django_bird.staticfiles.Asset]
django_bird.staticfiles.get_component_assets(component: django_bird.components.Component, asset_type: str | None = None) list[django_bird.staticfiles.Asset]

Get assets for a component, optionally filtered by type.

Args: component: The component to get assets for asset_type: Optional asset type extension to filter by (e.g., “css”, “js”)

Returns: A list of assets for the component, filtered by type if specified

class django_bird.staticfiles.BirdAssetStorage(*args: Any, prefix: str, **kwargs: Any)

Bases: django.contrib.staticfiles.storage.StaticFilesStorage

url(name: str | None) str
class django_bird.staticfiles.BirdAssetFinder

Bases: django.contrib.staticfiles.finders.BaseFinder

check(**kwargs: Any) list[django.core.checks.CheckMessage]
find(path: str, all: bool = False, find_all: bool | None = None) str | list[str] | None

Given a relative file path, return the absolute path(s) where it can be found.

list(ignore_patterns: collections.abc.Iterable[str] | None) collections.abc.Iterable[tuple[str, django.core.files.storage.FileSystemStorage]]

Return (relative_path, storage) pairs for all assets.

This method is used by Django’s collectstatic command to find all assets that should be collected.