Trot.Template
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 “templates/“.
Example:
defmodule PiedPiper do
use Trot.Router
use Trot.Template
@template_root "templates/root"
get "/compression" do
render("compression_results.html.eex", [weissman_score: 5.2])
end
end
Summary↑
compile(files, root) | Finds and compiles template files |
compile(file, module, root, arg4) | Compiles a template into a quoted expression in memory for faster rendering |
find_all(root) | Finds all template files under a given root directory |
hash(root) | Returns the hash of all template paths in the given root |
template_engine(file) | Determine which template module to use based a template’s file extension |
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.
Specs:
- hash(String.t) :: binary
Returns the hash of all template paths in the given root.
Determine which template module to use based a template’s file extension.