Mix phx.gen* Tweaking destinations for generated files and directories

When I use generators I can enforce some nesting for the contexts (and their associated schemas) but this does not seem to be the case for the web files, I’m also a bit worried with respect to the tests, is corresponding nesting required there?

I think the solution lies in the use of the --web option, will just try this now.

Edit: Yes that does it.

form:

mix phx.gen.html Dir.Cont Resource resource --web Dir

For the record: no :slight_smile: Elixir’s module nesting is merely an illlllooooosion :ghost: Although sometimes Phoenix does reflection on the module naming, but Elixir itself never does (at least not to my knowledge).

1 Like

Ah alright I thought that might be the case, still when I used the --web option the nesting was ultimately reflected in the test files.

I wonder why that is since it could just be done via the defmodule call, I guess it’s for compartmentalisation.

Oh I haven’t seen the generators lately. Does it actually nest defmodule like:

defmodule
  defmodule

?

No, I didn’t mean the nesting of defmodule I meant the nesting of directories being equivocated by the module name(path) passed to the defmodule call.

Ohhhhhhhh ya, there is no correlation between module names and files paths.