News for hackers. Stuff that matters.
Re:Ask HN: Is Erlang an albatross to Elixir adoption? by johnisgood on Monday May 09, 2022 @02:01PM (#31317545)
Phoenix seems quite bloated. Is there any way to make it work without JavaScript, or do I have to rely on it? I really wanted a web framework where I can have routers, templates, sessions, and the usual stuff and no JavaScript, only if I write it myself into the template. :(
Re:Ask HN: Is Erlang an albatross to Elixir adoption? by jolux on Monday May 09, 2022 @02:17PM (#31317773)
There’s no JavaScript unless you write it into the template. If you want to use LiveView that needs JavaScript but plain old templates do not.

As for bloat I don’t really agree but I can see how it might appear that way. Phoenix is actually not monolithic, it is sort of just a set of conventions and macros (batteries) that make using Plug and Ecto and some other libraries together more cohesive and more like programming in Rails. If you don’t like that approach you can also just use Plug and Plug.Router directly, which is more of a microframework feel like Flask or Sinatra.

Re:Ask HN: Is Erlang an albatross to Elixir adoption? by johnisgood on Monday May 09, 2022 @02:43PM (#31318112)
Got any resources for simple usages of Phoenix? Most of them are all about LiveView and a lot of stuff that uses JavaScript.

> There’s no JavaScript unless you write it into the template.

I want this. How do I achieve this? "mix phx.new" is not it, as there are JavaScript files in "assets/", for example.

Re:Ask HN: Is Erlang an albatross to Elixir adoption? by conor- on Monday May 09, 2022 @03:35PM (#31318712)
You pass the `--no-assets` flag when using `mix phx.new`[1]

Also ime, there's not many good blog posts or guides around Phoenix that I've seen. The sort of de facto resource would be the Programming Phoenix book. It's well worth the $25 considering the amount of effort Chris and co. seems to have put into it.

[1]https://hexdocs.pm/phoenix/Mix.Tasks.Phx.New.html

Re:Ask HN: Is Erlang an albatross to Elixir adoption? by johnisgood on Monday May 09, 2022 @04:10PM (#31319106)
Thank you! Will give it a go. :)
Re:Ask HN: Is Erlang an albatross to Elixir adoption? by ricketycricket on Monday May 09, 2022 @02:23PM (#31317851)
`mix phx.new foo --no-live` does that. LiveView is completely optional. Node/npm has been completely replaced by esbuild and even that is optional if you want to rip it out and handle assets another way.
Re:Ask HN: Is Erlang an albatross to Elixir adoption? by johnisgood on Monday May 09, 2022 @02:42PM (#31318094)
Yeah, I suppose that is why I thought it required JavaScript (the book instructed me to type --live). I was following the instructions of some books and there was JavaScript such as utils.js and whatnot.

I typed what you told me, but it does have "foo/assets/vendor/topbar.js" and "foo/assets/js/app.js". Not sure what those are though or if they are a necessity. It ends up being "deps/phoenix_html/priv/static/phoenix_html.js" on localhost:4000. Any ideas as to how to COMPLETELY avoid JavaScript? Are there any sources for that perhaps?

Re:Ask HN: Is Erlang an albatross to Elixir adoption? by conradfr on Monday May 09, 2022 @05:41PM (#31320140)
https://hexdocs.pm/phoenix/Mix.Tasks.Phx.New.html

I think you want the --no-assets option.