News for hackers. Stuff that matters.
Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o... by deniz-a on Tuesday November 23, 2021 @12:45PM (#29320756)
The pattern is that you use htmx for anything it can do, then use Alpine for things that shouldn't/can't require a server round-trip (toggling sidebar, animations etc).

You can reimplement htmx functionality with Alpine, but htmx is a lot better than `@click="fetch('/partial').then(res => res.text()).then(frag => $el.innerHTML = frag)"` all over the place (with a slight variation in that one component that you miss because of the noise).

Don't use _hyperscript just to be "'`consistent`'", use it because you want to. Being agnostic and playing well with other tools is a big thing for htmx. _hyperscript is lots of fun and lets you write very readable code, but you also need to stomach a 26mb bundle just to toggle some classes :/

(if anyone reading this can help us make it smaller, LMK)

Re:Django, HTMX and Alpine.js: Modern websites, JavaScript o... by recursivedoubts on Tuesday November 23, 2021 @12:49PM (#29320802)
> 26mb

ackshully, 21.2 kB:

https://bundlephobia.com/package/[email protected]

Which compares pretty well w/ alpine, which comes in at 21.7kB with its dependency:

https://bundlephobia.com/package/[email protected] - 17kB https://bundlephobia.com/package/@vue/[email protected] - 4.7kB

:)