Aspect is a compiling templating engine for Lua and OpenResty.
<!DOCTYPE html>
<html>
<head>
{% block head %}
<title>{{ page.title }}</title>
{% endblock %}
</head>
<body>
{% block content %}
<ul id="navigation">
{% for item in navigation %}
<li><a href="{{ item.href }}">
{{- item.caption|escape -}}
</a></li>
{% endfor %}
</ul>
<h1>My Webpage</h1>
{{ page.body }}
{% endblock %}
</body>
</html>
The recommended way to install Aspect is via LuaRocks:
luarocks install aspect
Or add src/?.lua
to package.path
:
package.path = '/path/to/aspect/src/?.lua;' .. package.path
The key-features areā¦
Aspect also has a console tool for rendering data
$ aspect /path/to/data.json /path/to/template.tpl