This repository has been archived on 2023-08-07. You can view files and clone it, but cannot push or open issues or pull requests.
temple/lib/temple/live_view_engine.ex

15 lines
326 B
Elixir

defmodule Temple.LiveViewEngine do
@behaviour Phoenix.Template.Engine
@moduledoc false
def compile(path, _name) do
require Temple
ast = path |> File.read!() |> Code.string_to_quoted!(file: path)
Temple.temple(ast)
|> EEx.compile_string(engine: Phoenix.LiveView.Engine, file: path, line: 1)
end
end