I’ve organized my Phoenix myapp_web
directory into concerns instead of the default organization which is based on module/file types (controllers, views, templates). I find this layout fits my mind better and leads to less jumping around to find the files I need.
So each of these concern folders has a controller and one or more views and templates in them. I was able to make this work by changing root
in myapp_web.ex
, removing the /template
portion.
def view do
quote do
use Phoenix.View,
root: "lib/myapp_web",
namespace: MyappWeb
And by adding the as:
option to all my routes.
Everything is peachy, except I would like to put shared views and layouts in a shared/
sub-director, either that or move all my “concerns” in to a concerns/
subdirectory. But either way Phoenix can no longer find my layouts or views. How can I address this?