Actually, I got it working. I must have made a typo.
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.
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 byPhoenix.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.
Bandit looks sweet. GitHub - mtrudel/bandit: Bandit is a pure Elixir HTTP server for Plug & WebSock applications
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.
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
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.
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?
Contrary to Phoenix.HTML.Form
core_components.ex
is completely userland. Adjust as needed. Copy from project to project. Whatever gets the job done.
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?
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).
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):
- Like Cowboy, config :prj, Endpoint, http[s] is where the Bandit config options go.
- Unlike Cowboy, any IP address other than 127.0.0.1 must be set/bound explicitly.
- 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.
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.
Afaik the components are meant to eventually replace Phoenix.HTML
.
Me! Tailwind was a game changer for me. Would love to learn more about it.
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.
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!
Issues have been resolved in Bandit 0.6.0, just released a moment ago.
Is anyone else having problems with a dead view web page not automatically reloading. I can see my changes being recompiled but the browser doesn’t automatically get refreshed.
Tried it with a Live View and it works fine - just seems to be a problem with views from a controller.
In case updated your Mac and Phoenix, I faced the same issue:
Try: mix deps.compile file_system (So your live reload will work!)