Phoenix 1.7.0-rc.0 is out!

Got it. Thanks for your work @chrismccord!

1 Like

I´m in tears.
Christmas came early this year.

5 Likes

Was sceptic about Tailwind until I saw some less-GUI-skilled developers write customer specific GUI’s they would never been able to with alternatives. And not worrying about boost their velocity for the things they already could do :slight_smile:

I’m up for the Tailwind book club - anyone else joining?

4 Likes

Actually, I got it working. I must have made a typo.

1 Like

I understand the mechanics of CSS, but still can’t build anything decent looking.
With tailwind I feel like a first-rate artist.

And now I’ll mix archive.install hex phx_new 1.7.0-rc.0 … release notes look very promising.
Thanks for the work, Phoenix team.

4 Likes

Congratulations.

All HTML rendering is then based on function components, which can be written directly in a module, or embedded from an external file with the new embed_templates macro provided by Phoenix.Component.

I am really looking forward to this one. I am using htmx these days and they have a nice essay on locality of behavior. This new feature helps in achieving that.

Great work as always and heartfelt thanks.

2 Likes

Bandit looks sweet. GitHub - mtrudel/bandit: Bandit is a pure Elixir HTTP server for Plug & WebSock applications

9 Likes

I was just going to ask about this.

Thanks to work by Mat Trudel, we now have the basis for first-class webserver support in Plug and Phoenix, allowing other webservers like Bandit to be swapped in Phoenix while enjoying all features like WebSockets, Channels, and LiveView.

Did anyone else start using Bandit?


Also, did anyone create a Core Component replacement design already?!?

We love what the Tailwind team designed for new applications, but we also can’t wait to see the community release their own drop-in replacements for core_components.ex for various frameworks of choice.

3 Likes

I tried it, it’s awesome.

I couldn’t make it work with Phoenix 1.6, however now it works flawlessly with Phoenix 1.7.


Here everyone, if you are not familiar with Bandit, checkout a talk from Elixir Conf 2021:

ElixirConf 2021 - Mat Trudel - bandit on the loose! Networking in Elixir demystified

15 Likes

Guys, as you might have read, we can just change the design present in the core_components.ex file and every generated page will inherit the design.

So I had a question, is anyone using the generated pages without deleting them? For instance as Admin pages??

I was thinking it’s a waste of good code, and associated tests that get generated!!


For instance by using:

mix phx.gen.live Photos Photo photos --web Admin

Which would generate the LiveViews in lib/app_web/live/admin/photo_live/ , namespaced AppWeb.Admin.PhotoLive instead of AppWeb.PhotoLive .

https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Live.html#module-web-namespace


I was looking for a way to salvage generated code and not need another library or generator to generated it for me.

I even asked @chrismccord if there was a nob or flag we can set to satisfy this need. :sweat_smile:

2 Likes

Not sure if this was raised before, but I’m wondering about form input components. On the one hand, LiveView ships with a form component. On the other hand, the Phoenix generators now generate styled input components.

How about shipping an unstyled <.input /> component with LiveView? Basically cover the functionality of Phoenix.HTML.Form.

Does that make sense or is it something that the team specifically decided not to do?

1 Like

Contrary to Phoenix.HTML.Form core_components.ex is completely userland. Adjust as needed. Copy from project to project. Whatever gets the job done.

1 Like

Thanks to everyone who contributed to 1.7!

I am having the following issue:

(Phoenix.Router.NoRouteError) no route found for GET /az/book/brief (PrjWeb.Router)
even though the list of available routes does contain
survey_path GET /az/book/brief PrjWeb.SurveyController :brief

I have not made any route changes since 1.6. The only notable thing about this and similar routes (none working under 1.7) is that they are all generated using a macro, a simplified version of which could be:

defmacro survey(path) do
  quote do
    get unquote(path <> "/brief"), SurveyController, :brief
  end
end

Is this a bug or am I missing something?

1 Like

Great to hear it’s working well!

Bandit should support any version of Phoenix prior to 1.7, but without support for WebSocket connections.

The big change in 1.7 that enables WebSocket support in servers other than Cowboy was the replacement of Phoenix’s Cowboy-specific WebSocket plumbing in 1.6 and earlier with a generic WebSocket interface named WebSock (you can think of it as ‘Plug for WebSockets’, basically).

12 Likes

It also worked well during my testing of 1.7. Thanks for your great work! There are a few points that could inform and facilitate the switch to Bandit (I hope that I understand them correctly):

  1. Like Cowboy, config :prj, Endpoint, http[s] is where the Bandit config options go.
  2. Unlike Cowboy, any IP address other than 127.0.0.1 must be set/bound explicitly.
  3. Bandit does not support on-the-fly gzip compression (reverse proxy to the rescue).

References to the above could help improve the “Using Bandit With Phoenix” documentation section, as would a prominent link to the Bandit.PhoenixAdapter page.

2 Likes

Not sure I’m a great fan of the copying approach - why not pull the unstyled components into Phoenix itself? There’s a reason why Phoenix.HTML exists, right? For example, Phoenix.HTML.select supports customizable prompts:

select(form, :role, ["Admin": "admin", "User": "user"], prompt: [key: "Choose your role", disabled: true])

But the new generated <.input type="select"> component only supports a string prompt.

2 Likes

Afaik the components are meant to eventually replace Phoenix.HTML.

2 Likes

:raised_hand: Me! Tailwind was a game changer for me. Would love to learn more about it.

2 Likes

Fantastic news - I’ve been waiting for this to start a new project.

I did find a typo in the docs - in Request Lifecycle > A new view:

   embed_templates "hello/*"

should be

 embed_templates "hello_html/*"

Happy to raise a “issue” but wasn’t sure where.

2 Likes

Noted! I’ll add this to the moduledoc of Bandit.PhoenixAdapter and link off the README / top-level ex_doc.

Also noted, and will change in the next release of Bandit (this default only applied to PhoenixAdapter; Bandit itself defaults to 0.0.0.0).

This is coming in the 0.7 release train later this year!

Thanks for the feedback!

4 Likes