I’m doing the same thing. You can set it on a view-by-view basis. Just modify the view function in your hello_web.ex
file so it starts like this:
def view(opts \\ [root: "lib/hello_web/templates"]) do
opts = opts ++ [namespace: HelloWeb]
quote do
use Phoenix.View, unquote(opts)
At the bottom of the file add a second macro to the one that is already there:
defmacro __using__({which, opts}) when is_atom(which) do
apply(__MODULE__, which, [opts])
end
Now start every view where you want to override the template location with code like this:
defmodule HelloWeb.UserView do
use HelloWeb, {:view, [root: "lib/hello_web/user/templates", path: ""]}
That should do the trick!