Aspect is a compiling templating engine for Lua and OpenResty.

Synopsis

<!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>

Installation

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

Features

The key-features are…

Aspect also has a console tool for rendering data

$ aspect /path/to/data.json /path/to/template.tpl