“Alpine is the modern jQuery, that’s my vision for it,” Porzio explained in an interview. “When I started in web development, jQuery was what you did to sprinkle in stuff on your front end. Your whole front end wasn’t driven by a frontend framework, it was driven by something like Rails. I still like to write web apps that way. I’ve come full circle, I did the whole SPA thing and there’s nothing wrong with it, per se, but for a lot of use cases it’s just way too much complexity.”
While technology like jQuery was perfectly fine for adding interactivity, it was too imperative and manual for Porzio’s tastes. He said he enjoyed the declarative and reactive nature of frameworks like React, Vue, and Angular, and so he created Alpine with those ideas in mind. At the same time, those frameworks separated out functionality and design into many different files, which made it difficult to find what was happening where.
“I want it right in the template, rather than maintaining all these different files and having to organize my frontend logic and really think through that stuff,” said Porzio. “Sometimes it’s easier to just say, ‘When this button, on the button itself, is clicked, set open to true and then, on the div that you want to open, show if open is true.'”
Backlash against Complexity
“They all kind of rely on this concept of faking a live site, faking an SPA, where instead of actually having that all live on the frontend, it all lives on the backend, and the front end just makes calls to the back end to get the new HTML and swap it into the page,” said Porzio. “Where Alpine started was, like, ‘we need something for modals, tabs, and dropdowns, because you shouldn’t have to hit a server for those things.'”
“Something like React or Vue, they can add more features to core, and because there’s these complicated build steps, what ships to your browser is only what you use,” said Porzio.
With Alpine, many users embed the framework using the <script> tag, which means the entire framework is included, and so, Porzio explained, “the more I add to Alpine, the bigger the bundle is that I’m just shipping to everybody, so I’m really careful about keeping the core slim, so that it’s still the lightest framework around.”
“There’s things that I would want to add, things that I think Alpine should tackle, but it would be just too many kilobytes, so I use plugins for those,” he added.
Moving forward, Porzio said he would like to see Alpine become “the tool for all of the backend frameworks” and part of his efforts will focus on education. To that end, he launched a components aspect to Alpine, which consists of educational videos and pre-built components for things like image carousels or radio buttons, all created with Alpine. Components are available on a single payment basis and currently offer 17 different components, with all future created components included.
Featured image via Pixabay.