LiveStyle.Registry (LiveStyle v0.13.1)

View Source

Shared fetch/define pattern for LiveStyle registries.

This module provides a macro that generates the common fetch/1, fetch!/1, and ref/1 functions used across LiveStyle's definition modules.

Usage

defmodule LiveStyle.Vars do
  use LiveStyle.Registry,
    entity_name: "CSS variable",
    manifest_type: :var,
    ref_field: :ident

  # Module-specific code...
end

Generated Functions

  • fetch/1 - Returns {:ok, entry} or {:error, reason}
  • fetch!/1 - Returns entry or raises
  • ref/1 - Extracts the ref_field from the entry
  • store_entry/2 - Helper to store entries in manifest (private)