DaAnalyst
Inspired by the today exchange with @josevalim regarding a particular maybe-LiveView-maybe-Alpine bug (see the links below) I’d like to open a discussion on the best way to proceed in future cases like this.
https://github.com/phoenixframework/phoenix_live_view/issues/2657
I agree with Jose’ that PETAL (LiveView+Alpine) users should have a single point of reference such as a single repository with just a README.md file where we could merge our knowledge base and best practices, a place that unlike various blogs around will have a history.
Does anyone know if such a repo exists already? If not, I can go about creating one.
In addition, maybe @AstonJ can make a special PETAL sub-category under Phoenix Forum.
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
:warning: Security advisory: Decimal DoS vulnerability
A vulnerability has been published for decimal where very large exponents can cau...
New
What IDE or editor are you using for Elixir development?
Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
Other Trending Topics
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
DaAnalyst
Delighted to see so much interest (3 likes so far)!
</sarc>Anyway, the
LiveView-Alpinegithub organization and itsintegrationknowledge-base repo can be found at the link below. It’s currently empty but I (we) will be adding content as we go.https://github.com/liveview-alpine/integration
greven
I went the Alpine route when LiveView was new and without any JS integration outside of Hooks, for micro interactions Alpine made so much sense (and I was familiar with Vue API which Alpine kinda of mimics).
I later dropped it in favour of just plain LiveView.JS usage and/or combined with Hooks.
Why? Well, because of the CSP (Content-Security Policy), reference: CSP — Alpine.js
I’m not comfortable with the trade back nor with the CSP violation, so I preferred to go the %JS{} / Hook routes.
Glad for your contribution, think that is a good idea. The Phoenix components PETAL framework makes use of Alpine, maybe it can also serve as inspiration for people following that route.
DaAnalyst
I get where you’re coming from, but I really don’t see how you can contrast
Phoenix.LiveView.JS+ LV hooks to Alpine.Hooks can be helpful for achieving the kind of client-side behavior that is triggered by the hook events. Beyond that (i.e. trying to manage complex state with them) it’s becoming an overkill. I know because I did plenty of that (3 - 4 years ago) before I started using Alpine.
The
JSmodule merely covers some very basic needs and cannot possibly replace the wide spectrum of Alpine application.greven
You are right, %JS can’t replace Alpine at all, and probably it never will. That is why we have hooks. I dont think hooks are overkill at all, simply a necessity and generally sprinkling some hooks are all we need in LV land. When hooks get co-located I think we really wont need Alpine at all.
But Alpine is very practical indeed inspite of the CSP violation.
DaAnalyst
Collocation will help organize them better, but it won’t solve what can and what can’t be done easily with them, that’s unless you find it acceptable to have more JS code then the template code with the hooks merely adding and removing the listeners which then invoke the JS code, for that’s the only way you can replace Alpine, all while reinventing the wheel over and again.
Speaking of which, have you tried replacing any of the following with the hooks (never mind not being “collocated”):
x-model+x-effectx-timeagox-intersectI did some of those and, boy, do I not want to do stuff like that again with hooks.
Alpine is very practical, indeed. I’d compare it’s practicality relative to writing hooks as using tailwind relative to maintaining separate CSS/SCSS files.
cmo
I found managing compex state in Alpine a bit of a mess and moved to JS commands and hooks too. The interaction between a hook and liveview’s lifecycle is much easier to manage than liveview and alpine.
I never used the
x-thingos you mentioned though. Not sure they were around back then.DaAnalyst
There are some people reporting issues with using Alpine, but more often than not those originate from their lack of understanding how to do things correctly (hence this ongoing effort). Also, I have 0 issues with Alpine (except for performance issues) while working on a relatively large and very granular app (in terms of both LiveComponents and function components).
As for the
x-thingos, what can I say, the requirements I got are quite demanding on the UX but admittedly not all apps may have such a case.DaAnalyst
The initial entries are now available (in the README.md):
https://github.com/liveview-alpine/integration