Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customized scaffold templates

I've changed the following files to have a customized scaffold generator which saves a ton of work in the development process. The deps directory is in .gitignore so that's not a valid way to share those changes with other developers in the team. What is a good way to customize those default templates so that everybody in the development team can use them?

$ tree deps/phoenix/priv/templates/phoenix.gen.html
deps/phoenix/priv/templates/phoenix.gen.html
├── controller.ex
├── controller_test.exs
├── edit.html.eex
├── form.html.eex
├── index.html.eex
├── new.html.eex
├── show.html.eex
└── view.ex
like image 632
wintermeyer Avatar asked Oct 19 '22 09:10

wintermeyer


1 Answers

The mix task look at first to the priv folder in your project if there nothing exists the default of phoenix dep will used.

Make a copy of deps/phoenix/priv/templates/phoenix.gen.html to priv/templates/phoenix.gen.html and it will work.

I'm not sure if there some documentation about this function, but you can look at deps/phoenix/lib/mix/tasks/phoenix.gen.html.ex you see at the bottom the function paths. That define the lookup to ./ and after them phoenix dep.

defp paths do
  [".", :phoenix]
end

Hope this helps.

like image 147
Fabi755 Avatar answered Oct 21 '22 21:10

Fabi755