I want to use ~H as a template engine to create an HTML file (which I can then process with another tool to PDF). I already have these templates working in a liveview-app, but need some of the views as PDF.
I was hoping I’d find an equivalent to EEx — EEx v1.21.0-dev - example:
# sample.html.heex
<MyComponent.greet name={@name} />
# sample.ex
defmodule Sample do
require HEEx # <--- does not exist
HEEx.function_from_file(:def, :sample, "sample.html.heex", [:a, :b])
end
# iex
Sample.sample(name: "World")
#=> "Hello, World!"
You mean like
EEx.function_from_file(
:def, :sample, "sample.eex", [:assigns], engine: Phoenix.LiveView.HTMLEngine)
this returns a %Phoenix.LiveView.Rendered and it doesn’t look like I’ll get a HTML from that easily.






















