-
Hello! So this question looks a bit dumb, the first answer would probably be to "go read and you'll understand" but I might be either lacking the understanding of the technical terms, or I could also just be dumb and not understand. When I look at alpine I tell myself "So basically its like putting javascript in my html instead of in a script tag?" Also, on top of that, in a small project I'm using htmx. Alpine is often used in complimentary because people say that they really fit well. Hopefully you can help me out to clear whatever confusion I built in my head Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
In my mind, AlpineJS is the best of both worlds when it comes to Javascript. It is light and agile like jQuery, but it is still data driven like Vue/React/Angular/etc. The full fledged frameworks are data driven, which is good, but IMO they are often too much for a lot of SSR projects that may not want to maintain duplicate sets of logic in the front and back ends. jQuery is good because of how agile and easy to use it is, but it's lack of being data driven makes it very easy to write wild unmaintainable code. Our primary language is PHP which renders views to the browser, and AlpineJS is powerful enough to give us all the front end interactivity we need. |
Beta Was this translation helpful? Give feedback.
-
Yes. That's the beauty of it.
No, you understand it. You get a lot of clarity for the locality of behavior that can be easily seen in the DOM and processed even in our squishy human brains. You don't get side effects or issues of not know how X thing is doing Y. It's right there.
They do, since the markup can have most of it's behavior entirely contained inside of it. So HTMX does a swap, and your alpine just works. You don't need to be concerned about having stuff process to hook it up, or accidentally running too many times, or any of that. Alpine is just for declarative data binding. You have data, and you tell the dom how to connect that data to the dom. That's it. Now those just work. |
Beta Was this translation helpful? Give feedback.
Yes. That's the beauty of it.
No, you understand it.
You get a lot of clarity for the locality of behavior that can be easily seen in the DOM and processed even in our squishy human brains. You don't get side effects or issues of not know how X thing is doing Y. It's right there.
They do, since the markup can have most of it's behavior entirely conta…