With Phoenix 1.5.0 release, the generated app offers default configuration in scaffold for live_view. A default phoenix app with the --live flag now generates a different layout set than the current (at the time of this issue, v 0.13.1) phoenix_slime. Phoenix now uses a root, app, and live layout templates.
After manually converting over the generated layout files, and proving those to be functional, converting the inner generated content (App.PageLive.html.leex) results in an error. Build prior to transforming template to slimleex gets re-used, so have to delete build file and rebuild to produce the error, otherwise appears to fail silently.
render/1 was not implemented for PhxslimeWeb.PageLive.
Make sure to either explicitly define a render/1 clause with a LiveView template:
def render(assigns) do
~L"""
...
"""
end
Or create a file at "lib/phxslime_web/live/page_live.html.leex" with the LiveView template.
In the call to Phoenix.LiveView.renderer, the block generating the error:
defmodule Phoenix.LiveView.Renderer do
@moduledoc false
defmacro __before_compile__(env) do
render? = Module.defines?(env.module, {:render, 1})
template = template_path(env)
case {render?, File.regular?(template)} do
{true, true} ->
IO.warn(
"ignoring template #{inspect(template)} because the LiveView " <>
"#{inspect(env.module)} defines a render/1 function",
Macro.Env.stacktrace(env)
)
:ok
{true, false} ->
:ok
{false, true} ->
ast = Phoenix.LiveView.Engine.compile(template, template_filename(env))
quote do
@file unquote(template)
@external_resource unquote(template)
def render(var!(assigns)) do
unquote(ast)
end
end
{false, false} ->
message = ~s'''
render/1 was not implemented for #{inspect(env.module)}.
Make sure to either explicitly define a render/1 clause with a LiveView template:
def render(assigns) do
~L"""
...
"""
end
Or create a file at #{inspect(template)} with the LiveView template.
'''
IO.warn(message, Macro.Env.stacktrace(env))
quote do
def render(_assigns) do
raise unquote(message)
end
end
end
end
In the {false, false} case, the view's render function is not defined and File.regular? returns false.
Elixir v 1.10.2; Phoenix v 1.5.0
Github Repo project: https://github.com/CatsOnFilm/phxslime
With Phoenix 1.5.0 release, the generated app offers default configuration in scaffold for live_view. A default phoenix app with the --live flag now generates a different layout set than the current (at the time of this issue, v 0.13.1) phoenix_slime. Phoenix now uses a root, app, and live layout templates.
After manually converting over the generated layout files, and proving those to be functional, converting the inner generated content (App.PageLive.html.leex) results in an error. Build prior to transforming template to slimleex gets re-used, so have to delete build file and rebuild to produce the error, otherwise appears to fail silently.
In the call to Phoenix.LiveView.renderer, the block generating the error:
In the {false, false} case, the view's render function is not defined and File.regular? returns false.
Elixir v 1.10.2; Phoenix v 1.5.0
Github Repo project: https://github.com/CatsOnFilm/phxslime