Add HTML to --no-html

Hello,
I created an application without HTML (when I started with this application, I didn’t needed it).
Now I would like to HTML, I installed {:phoenix_html, “~> 2.11”}, but got the following error:

Could not render "app.html" for AppWeb.LayoutView, please define a matching clause for render/2 or define a template at "lib/api_web/templates/layout". No templates were compiled for this module. Assigns:

Code:
page_controller.ex:

defmodule AppWeb.PageController do
  use AppWeb, :controller

  def index(conn, _params) do
    render(conn, "index.html")
  end
end

layout_view.ex

defmodule AppWeb.LayoutView do
  use AppWeb, :view
end

Have you tried creating the layout file, as suggested in the error message? I think it should be lib/api_web/templates/layout/app.html.eex.

If you want to make sure to follow Phoenix defaults, you can always create a new project and see how it‘s set up :slight_smile:

3 Likes