Adding `--tailwind` flag to phx.new

I think this type of thing really brings to attention features that exist in other frameworks but don’t here. If we had application template support as a feature (like Rails) this could be a solved problem outside of the official generator, but we’d still have what feels to be native support from a mix usability POV.

It was once talked about but here but ultimately shut down: Phoenix Application Template customization

One thing I learned from working with dozens of teams (freelance dev) and dozens of my own projects is that it’s super handy to start new projects with front-end decisions already made. If no such support is built into a generator, then people end up making custom skeleton / base projects and result in using find / replace to adjust names in a brittle but working way.

Also one thing I learned from having training material that tens of thousands of people use is that it’s not possible to make everyone happy, especially when it comes to front-end decisions. There’s not only bootstrap vs tailwind (and others) but then there’s stimulus vs alpine vs vue vs react too for the JS.

And then there’s LV vs not LV in the Phoenix case.

This story already unfolded in Laravel where they have a bunch of these options built into their official generators (they have a LV alternative tool), and it had pretty mixed results from the community because it ended up being choice overload and it felt like too many opinions and complexity was introduced. So much that the creator of Laravel was getting verbally assaulted online.

Rails seems to have gotten it right tho. Keep the official generator simple enough that out of the box you get a working example but don’t make front-end opinions beyond getting the plumbing set up (webpack, etc.). Where Phoenix differs is the lack of an application template system where the community can easily extend the main generated template with custom stuff.

9 Likes