require "kemal"
require "crinja"
get "/" do
crinja = Crinja.new
crinja.loader = Crinja::Loader::FileSystemLoader.new("src/views/")
template = crinja.get_template("home.html.j2")
template.render({
"title" => "With CRinja",
"planets" => ["Mercury", "Venus", "Earth", "Mars"],
"cond" => Random.new.next_bool,
})
end
Kemal.run
<title>{{ title }}</title>
<h1>{{ title }}</h1>
<ul>
{% for planet in planets %}
<li>{{ planet }}</li>
{% endfor %}
</ul>
{% if cond %}
Condition is true
{% else %}
condition is false
{% endif %}