Module

health.validators.assets

Asset validator - checks asset processing and optimization.

Validates:

  • Asset files copied to output
  • Asset hashing/fingerprinting works (if enabled)
  • Minification applied (if enabled)
  • No duplicate assets
  • Reasonable asset sizes

Classes

AssetValidator
Validates asset processing and optimization. Checks: - Assets directory exists and has files - Ass…
5

Validates asset processing and optimization.

Checks:

  • Assets directory exists and has files
  • Asset types are present (CSS, JS, images)
  • No duplicate assets (same content, different names)
  • Asset sizes are reasonable
  • Minification hints (file size analysis)
Inherits from BaseValidator

Methods 1

validate
Run asset validation checks.
2 list[CheckResult]
def validate(self, site: Site, build_context: BuildContext | Any | None = None) -> list[CheckResult]

Run asset validation checks.

Parameters 2
site Site
build_context BuildContext | Any | None
Returns

list[CheckResult]

Internal Methods 4
_check_asset_types
Check expected asset types are present.
1 list[CheckResult]
def _check_asset_types(self, assets_dir: Path) -> list[CheckResult]

Check expected asset types are present.

Parameters 1
assets_dir Path
Returns

list[CheckResult]

_check_asset_sizes
Check asset sizes are reasonable.
2 list[CheckResult]
def _check_asset_sizes(self, assets_dir: Path, site: Site) -> list[CheckResult]

Check asset sizes are reasonable.

Parameters 2
assets_dir Path
site Site
Returns

list[CheckResult]

_check_duplicate_assets
Check for duplicate assets (same size and name pattern).
1 list[CheckResult]
def _check_duplicate_assets(self, assets_dir: Path) -> list[CheckResult]

Check for duplicate assets (same size and name pattern).

Parameters 1
assets_dir Path
Returns

list[CheckResult]

_check_minification_hints
Check if assets appear to be minified based on file size patterns.
2 list[CheckResult]
def _check_minification_hints(self, assets_dir: Path, site: Site) -> list[CheckResult]

Check if assets appear to be minified based on file size patterns.

Parameters 2
assets_dir Path
site Site
Returns

list[CheckResult]