Recently, HTMX has been receiving a lot of attention. However, there have also been concerns that 14kb almost 16kb is quite large for a library aiming

Build your own HTMX

submited by
Style Pass
2024-05-07 17:30:07

Recently, HTMX has been receiving a lot of attention. However, there have also been concerns that 14kb almost 16kb is quite large for a library aiming to reduce the amount of Javascript. And while this comparison is not quite fair (actually far from it!), Preact comes in at just 3kb, and is seen in roughly the same space of "React alternatives".

In this post, I attempt to show that the core of HTMX is actually quite simple to replicate. My goal is to make what I would consider myself to be 80% of HTMX work, in 10% of the size. To me, this means being able to fully run the original active search demo, without any modifications. Of course, my 80% might not be yours, hence this post instead of just another library. In general, I assume that you are already familiar with HTMX; if you are not, please just close this page and check it out. It is a good library.

HTMX offers a variety of advanced features and is highly extensible and configurable to justify its size. Including its predecessor Intercooler.js, it has been in development for over a decade. It handles a lot of edge cases, supports ancient browsers, but is also able to do the cool modern stuff, like using view transitions!

Leave a Comment