Aino.View (aino v0.6.0)

Compile templates into modules with a render function

compile [
  "lib/app/templates/folder/index.html.eex"
]

Generates the following render functions:

def simple_render("index.html", assigns) do
  # compiled index.html.eex
end

def render(token, "index.html", assigns) do
  # calls simple_render("index.html", assigns)
  # assigns to the `response_body` field on `token`
end

Link to this section Summary

Functions

Compile a list of templates into render functions

Compile an individual file into a quoted render function

Manages default assigns before rendering a template with a token

Allow a value to skip escaping for HTML

Link to this section Functions

Link to this macro

compile(files)

(macro)

Compile a list of templates into render functions

Link to this function

compile_template(file)

Compile an individual file into a quoted render function

For example, lib/app/templates/index.html.eex would generate the following:

def render("index.html", assigns) do
  # compiled index.html.eex
end
Link to this function

render_template(module, token, filename, assigns)

Manages default assigns before rendering a template with a token

Assigns the response value to response_body

Allow a value to skip escaping for HTML