DaAnalyst
A PETAL "lobbying" group
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.
Most Liked
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
In order for Alpine to be able to execute plain strings from HTML attributes as JavaScript expressions, for example
x-on:click="console.log()", it needs to rely on utilities that violate the “unsafe-eval” content security policy.
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.
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
The initial entries are now available (in the README.md):
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








