Phoenix - allow specifying project template path in

mix generates a project by scaffolding templates specified at installer/templates and I think it could be a good idea to allow passing an argument to mix which will override path where to look for templates first. Let’s say I run mix myapp --templates-path=~/phx_tpl/blog and I have the following structure in ~/phx_tpl/blog:

├── phx_single
│   ├── config
│   │   └── dev.exs
│   ├── lib
│   │   └── app_name
│   │       └── web
│   │           └── web.ex
│   └── mix.exs
├── phx_test
│   └── controllers
│       └── page_controller_test.exs
└── phx_web
    └── controllers
        └── page_controller.ex

In this case project generated would have following files being generated from custom templates:

├── config
│   ├── dev.exs
├── lib
│   └── app
│       └── web
│           └── controllers
│               └── page_controller.ex
├── mix.exs
└── test
    └── web
        └── controllers
            └── page_controller_test.exs

while the rest of the app will be generated from Phoenix default templates.
I’m very interested in what community and, particularly, Phoenix maintainers, would think about it.

1 Like

You can put custom templates in priv/templates ( )

You could also look at if you want more customization.

1 Like

Seems not quite what I’ve meant:
priv/templates can be used for overriding templates from phoenix_root/priv/templates, while I was asking about phoenix_root/installer/templates and while first is useable because you have mix task (ex.) phx.gen.html in deps/phoenix, the one comes from phx_new archive.
The second option is a bit different as well and is about writing app template from scratch, not allowing to extend how I want.
Actually, I ended up just rewriting Phoenix installer (, that works, but that feels like a big hack and that’s why I’m asking about support for Phx installer templates as an option.