Lavash.Template.Compiled (Lavash v0.4.0-rc.1)

Copy Markdown View Source

Represents a compiled Lavash template with source preservation.

This struct holds both the compiled HEEx AST and the original source string, enabling:

  • Server-side rendering via the compiled HEEx
  • Client-side JS generation for components (from source)

Usage

render fn assigns ->
  ~L"""
  <div>{@count}</div>
  """
end

Fields

  • :source - Original template source string
  • :compiled - Compiled HEEx AST (quoted expression)
  • :context - Compilation context (:live_view or :component)
  • :file - Source file path
  • :line - Source line number

Summary

Types

context()

@type context() :: :live_view | :component

t()

@type t() :: %Lavash.Template.Compiled{
  compiled: Macro.t(),
  context: context(),
  file: String.t(),
  line: non_neg_integer(),
  source: String.t()
}