Trot v0.7.0 Trot.Template View Source

Server side rendering of HTML using EEx templates. When the application is compiled all of templates under a given path are loaded and compiled for faster rendering. A render/2 function is generated for every template under the module attribute @template_root.

By default, @template_root is “priv/templates/“.

Example:

defmodule PiedPiper do
  use Trot.Router
  use Trot.Template
  @template_root "priv/templates/root"

  get "/compression" do
    render("compression_results.html.eex", [weissman_score: 5.2])
  end
end

Link to this section Summary

Functions

Finds and compiles template files

Compiles a template into a quoted expression in memory for faster rendering

Finds all template files under a given root directory

Returns the hash of all template paths in the given root

Determine which template module to use based a template’s file extension

Link to this section Functions

Finds and compiles template files.

Link to this function compile(file, module, root, arg4) View Source

Compiles a template into a quoted expression in memory for faster rendering.

Finds all template files under a given root directory.

Returns the hash of all template paths in the given root.

Determine which template module to use based a template’s file extension.