HEEx template parser for Lua. Parse Phoenix LiveView templates in Lua applications.
Download from GitHub Releases:
# Download the latest release
curl -LO https://github.com/notactuallytreyanastasio/heex-lua/releases/latest/download/heex-lua.tar.gz
tar -xzf heex-lua.tar.gzlocal heex = require("heex")
-- Parse a HEEx template
local doc = heex.parse([[
<div class={@class}>
<.button variant="primary">
Click me
</.button>
</div>
]])
-- Render back to HTML
print(heex.render_html(doc))
-- Get JSON AST for tooling
print(heex.render_json(doc))
-- Debug tree view
print(heex.render_debug(doc))Parses a HEEx template string and returns an AST.
Renders the AST back to an HTML string.
Renders the AST as a JSON string (useful for tooling).
Renders a debug tree view of the AST.
- HTML elements and attributes
- Self-closing elements (
<br />,<input>) - Phoenix components (
.button,MyApp.Button) - Slots (
:header,:footer) - Expressions (
{@value},{@user.name}) - Dynamic attributes (
class={@class}) - Spread attributes (
{@rest}) - Special attributes (
:if,:for,:let) - EEx tags (
<%= %>,<% %>,<%# %>) - HTML comments (
<!-- -->)
- Lua 5.1+ or LuaJIT
Generated from httpeex using Temper.
MIT