Hacker News new | ask | show | jobs
by deniz-a 1671 days ago
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)

1 comments

> 26mb

ackshully, 21.2 kB:

https://bundlephobia.com/package/hyperscript.org@0.9.0

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

https://bundlephobia.com/package/alpinejs@3.5.2 - 17kB https://bundlephobia.com/package/@vue/reactivity@3.2.22 - 4.7kB

:)