charge/component

Types

pub type Component(a) =
  #(String, fn(RenderData, element.ElementTree) -> a)

Data to be passed when rendering a component

pub type RenderData {
  RenderData(
    source_path: option.Option(fs.Path),
    site_path: fs.SitePath,
    out_dir: fs.Path,
  )
}

Constructors

  • RenderData(
      source_path: option.Option(fs.Path),
      site_path: fs.SitePath,
      out_dir: fs.Path,
    )

    Arguments

    source_path

    The path of the source file that the HTML comes from

    site_path

    The path of the HTML file being rendered

    out_dir

    The output directory for the pipeline

Values

pub fn new(
  tag tag: b,
  visit visit: fn(RenderData, element.ElementTree) -> a,
) -> #(b, fn(RenderData, element.ElementTree) -> a)

Create a new component given a tag and visit method. Thie type of visit will depend on the context in which the component is being used

Search Document