Re:Alpine.js Magic Helpers Library
by danvk on Saturday February 13, 2021 @07:23PM
(#26128437)
Could you say a little more about the sort of project you’d use Alpine on? “filled a massive void many people didn't even know existed” is certainly intriguing!
[ Parent
| on HN ]
Re:Alpine.js Magic Helpers Library
by earthboundkid on Saturday February 13, 2021 @11:29PM
(#26129691)
I’ve been using it for projects where a non-JS backend mostly handles templates, but I still want modern JS framework-like interactivity. A nice thing compared to Vue and React is that Alpine takes its template from your HTML, not your JS, so all your JS needs to have is the controller data logic, and the actual template stuff can be with your non-JS template code.
Re:Alpine.js Magic Helpers Library
by ficklepickle on Sunday February 14, 2021 @01:55PM
(#26135008)
Clearly you have never used Vue, because it works in the exact same way.
Alpine looks like Vue without computed properties.
Re:Alpine.js Magic Helpers Library
by earthboundkid on Sunday February 14, 2021 @03:04PM
(#26135730)
I have used Vue. In Vue, the templates are compiled and included if you use SFC, which is the preferred method. If you don’t use SFC, you have to ship the Vue compiler to your clients and that is not small. It’s a tradeoff.
Alpine doesn’t have a VDOM, so there’s no compiler and no equivalent of SFCs.
Re:Alpine.js Magic Helpers Library
by jackconsidine on Saturday February 13, 2021 @11:27PM
(#26129683)
Sure! Basically we had a thorny problem that needed to be solved on the frontend- users would be picking a plan, adding a payment, and possibly applying a promo code. JS is a prerequisite for Stripe payment collection and in general this solution would have been a non-starter in a backend template. But this was the only such page in the application, so it really felt like overkill to integrate an SPA like Vue or React. Vue's drop-in CDN is close, but there's still some setup boilerplate that was nice to do without.