Alpine.js is one of those ideas that filled a massive void many people didn't even know existed (I certainly didn't, though was subconsciously annoyed with the options). Data-centric, declarative template rendering was married to SPA frameworks, which are very good at what they do but are often overkill. Alpine cut development time in half for one of my projects and I'm looking forward to reaching for it again.
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!
Alpine.js Magic Helpers Library
11–19 of 19 posts
Re: Alpine.js Magic Helpers Library
#12Loving the PETAL stack. Phoenix Elixir TailwindCSS AlpineJS LiveView
Re: Alpine.js Magic Helpers Library
#13Earlier quoted context omitted.
AFAIK, Vue filled that void before alpine. and alpine is micro Vue to be used when your needs are so small, that vue becomes an overkill. is there any other advantage of alipne over vue, aside from file size?
Zero build tooling is necessary with Alpine.js, just import it through a script tag, ES module script import, etc. and you're done. No webpack setup, no bundling--nothing. Vue can be used like that too but from what I understand there are some tradeoffs (and it should be noted the modern wave of near zero config build tools like vite, snowpack, etc. easily bundle and build components like vue automatically too). I th…
wait, what? that is not true. if you want a sprinkle of interactivity, you include vue with script tag and write small components over your html & css, jsut like you do with alpine
alpine actually takes the inspiration from vue in terms of this. but is optimised for small file size.
Re: Alpine.js Magic Helpers Library
#14Alpine.js is one of those ideas that filled a massive void many people didn't even know existed (I certainly didn't, though was subconsciously annoyed with the options). Data-centric, declarative template rendering was married to SPA frameworks, which are very good at what they do but are often overkill. Alpine cut development time in half for one of my projects and I'm looking forward to reaching for it again.
From what I can see, Alpine is an SPA framework.
Re: Alpine.js Magic Helpers Library
#15Alpine.js is one of those ideas that filled a massive void many people didn't even know existed (I certainly didn't, though was subconsciously annoyed with the options). Data-centric, declarative template rendering was married to SPA frameworks, which are very good at what they do but are often overkill. Alpine cut development time in half for one of my projects and I'm looking forward to reaching for it again.
AFAIK, Vue filled that void before alpine. and alpine is micro Vue to be used when your needs are so small, that vue becomes an overkill. is there any other advantage of alipne over vue, aside from file size?
Alpine doesn't have any of those (eg. the devtools for it are a community project).
Re: Alpine.js Magic Helpers Library
#16This is really cool. I absolutely love Alpine, and a lot of these look like they could come in quite handy. TIL (by reading the source code) that you can add your own $functions to Alpine as well! I will definitely be making use of that functionality at some point.
There's a template repo/file you can use in that org https://www.github.com/alpine-collective/plugin/tree/master/....
Re: Alpine.js Magic Helpers Library
#17Earlier quoted context omitted.
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!
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.
Alpine looks like Vue without computed properties.
Re: Alpine.js Magic Helpers Library
#18Earlier quoted context omitted.
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.
Clearly you have never used Vue, because it works in the exact same way. Alpine looks like Vue without computed properties.
Alpine doesn’t have a VDOM, so there’s no compiler and no equivalent of SFCs.
Re: Alpine.js Magic Helpers Library
#19Earlier quoted context omitted.
Zero build tooling is necessary with Alpine.js, just import it through a script tag, ES module script import, etc. and you're done. No webpack setup, no bundling--nothing. Vue can be used like that too but from what I understand there are some tradeoffs (and it should be noted the modern wave of near zero config build tools like vite, snowpack, etc. easily bundle and build components like vue automatically too). I th…
> With vue if you want to make something that's mostly static but with some dynamic flourishes you need to go deep down a rabbit hole of SSR, static site gens, Gridsome, etc. etc. and it can really make your head spin wait, what? that is not true. if you want a sprinkle of interactivity, you include vue with script tag and write small components over your html & css, jsut like you do with alpine alpine actually takes…
In contrast with alpine, you'd write all your content as plain HTML. Google's crawler sees it and indexes it like any other static content site. Then alpine sprinkles in a bit of interactivity on top for your users. Getting the same behavior with vue (static content with dynamic stuff attached to the DOM later) is non-trivial.