6 ms·
Htmx 4.0 is over 100kb / 2,000 lines of code. Isn't there a way to slim this down some? I mean, isn't the basic idea just a couple lines of code? I remember AJA
by Xeoncross 19d ago
Htmx 4.0 is over 100kb / 2,000 lines of code. Isn't there a way to slim this down some? I mean, isn't the basic idea just a couple lines of code? I remember AJAX 2.0 or whatever loaders that were only 1-5kb wrappers around XHR back in the day. Now we have fetch() which is even more basic:
fetch('/my/api/content.html')
.then(response => response.text())
.then(html => {
document.getElementById('content').innerHTML = html;
});
I don't mean to imply this is close to total number of Htmx features, but fetching islands of content is the core idea and I feel like we're way past feature bloat at this point for something that is supposed to be simpler than React (Preact is only 10kB)
- moebrowne 19d agoWhere are you getting those numbers from? The minified code is about 40kB before compression and about 13kB with gzip. https://bundlephobia.com/package/htmx.org@4.0.0 https://bundlephobia.com/package/htmx.org@4.0.0
- Xeoncross 19d ago103KB is the actual source code. You should not be reading or debugging the minimized or gzip/transport bytes.
- yawaramin 18d agoYeah but when you're reading the actual source code you're not thinking in terms of bytes, you're looking and files and line counts. Htmx is deliberately maintained as a single, no-dependency file of about 5000loc. The maintainers are of the opinion that it reduces complexity, and I tend to agree.
- recursivedoubts 18d agoyou can check out fixi if you want to see a minimalist take on it: https://github.com/bigskysoftware/fixi/blob/master/fixi.js https://github.com/bigskysoftware/fixi/blob/master/fixi.js