4 ms·
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 ad
by rk06 6y ago
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?
- qbasic_forever 6y agoZero 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 think from a usage perspective Alpine.js puts you more into a progressive enhancement mindset and focus too. 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. With Alpine.js just write HTML and CSS, then add a bit of interactivity where it's needed--you can be done with an entire project in the time it takes to understand and setup an isomorphic SPA.
- rk06 6y ago> 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 the inspiration from vue in terms of this. but is optimised for small file size.
- qbasic_forever 6y agoYou don't get server-side rendering with a simple vue component though. I.e. when Google's crawler hits your site it just sees a blank html page with a div and nothing more, and your SEO is zero. For a content-heavy site like a blog this is a death sentence of discoverability, and it's why I mentioned you have to go down a deep rabbit hole of extra tech like SSR, static site gens like Gridsome, etc. to resolve it (all with a new set of tradeoffs to consider). 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.
- HugoDF 6y agoVue Can be used in the same way as Alpine, but it's very tempting to start using the CLI, single file components etc. Alpine doesn't have any of those (eg. the devtools for it are a community project).