Cool JavaScript Framework – Alpine.js

Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost.

Alpine.js: The JavaScript Framework That's Used Like jQuery, Written Like  Vue, and Inspired by TailwindCSS | CSS-Tricks

This tool’s syntax is almost entirely borrowed from Vue (and by extension Angular).

Alpine roots from server-rendered-app background. Alpine fills a hole in between Vanilla JS/JQuery and large frameworks like Vue/React. The complexity/overhead of Vue/React etc. doesn’t justify its value in a lot of cases. A number of times we just need to add bindings and simple interactions to server-rendered pages.

Alpine can also be used to build custom SPA using plain JavaScript routers, this would help in achieving SPA functionality at a low cost, low overhead for developers and make web applications development faster, ultimately resulting in a simple performant web application. This client server easy separation can lead to easy creation of PWA and Hybrid mobile app.

Using Alpine we can achieve the data-driven reactivity and declarative template expressions of VueJS without overhead.

Alpine is unique in these ways:

  • Use it without maintaining a separate JS file or <script> tag (although you can easily break code out into separate files and such if you need to)
  • It doesn’t use a virtual-dom at all and uses Mutation Observer to react to DOM manipulations from outside JS
  • It’s lightweight. It’s under 5kb gzip
  • It has a really nice API for listening for and dispatching native browser Event/Custom Events rather than using its own event system. This makes it a really powerful tool for interacting with third-party libs.

References:
1. https://github.com/alpinejs/alpine
2. https://news.ycombinator.com/item?id=22281975