LiveView: files not being generated

I’m going through Programming Phoenix LiveView book, after running mix phx.new pento --live on Phoenix 1.6.2, the necessary folders and files are not being generated. There’s no LiveView route in the router as indicated by the book.

Apparently with 1.6 you don’t give the --live option anymore when creating a Phoenix app. Rather, you pass --no-live if you don’t want to have LiveView. LiveView is already enabled, but there is no live/ folder. I’m still not sure if you have to create the live/ folder – I’m also currently working through the first steps of tutorials on LiveView.

1 Like

I think it is still good practice to create a app_web/live folder for those LiveViews, even though the generator doesn’t do it by default. This way it follows the pattern set by the other folders for Controllers, Templates, and standard Views. Anyone looking at the directory structure will know what kind of files are inside.

Hi @kodepett - I gave more info about this in another thread, including links to a gist with the “missing” files. I hope that helps! :slight_smile:

3 Likes

I’ve come back to this thread half a dozen times in the past few months for different projects. I think it was a really bad idea to remove generating this boilerplate automatically and instead relying on Google → Forum → Random Public Gist to get going.

1 Like