Where are the templates used by 'mix new' defined?

I’m trying to make a custom version of mix new that includes certain dependencies out of the gate. My assumption is I just need to edit the templates used by the default task. Looking at the source I can’t seem to find where they are defined.
For instance when creating the lib/#{module}.ex file the task uses create_file("lib/#{mod_filename}.ex", lib_template(assigns)) but the function lib_template is not defined anywhere that I can find.

It stumped me also, seeing lib_template defined only once with GitHub search :slight_smile:

But if you scroll lower down in the file, you’ll see the templates defined.

lib_template is a function generated by the embed_template macro.

You can find what you’re looking for here.

2 Likes