Is Htmx Gaining in Popularity?
trends.builtwith.com
trends.builtwith.com
I’ve also explored it briefly a couple days ago (with a Go server) and it’s actually really really convenient to work with.
My next project will definitely be in Go + htmx + tailwind and MySQL/PostgreSQL
I’m excited about working with plain html again and not having to deal with over bloated js projects.
Dependency issues will be a thing of the past
I think HTMX and tailwind fit well together because I also see HTMX as a kind of "utility framework". It augments the standard html elements with additional capabilities using attributes and HATEOAS.
Also, their discord is very active and very very helpful
It’s concise; writing css directly in my html and not feeling like I’m cluttering the file makes readability great.
Debugging styling in SPAs is significantly easier since I can just glance at the DOM in the browser dev tools and be able to quickly find the CSS causing the styling issue (just looking through the HTML tree, not having to look through styling tool saves time)
DaisyUI is a library built on top of it; a lot of great snippets of styles elements there.
The config file; all custom configs are concise in one file.
It makes things like conditional styling or just if you have any state determining styling, it is very easy to do and readable
But in summary, honestly for me it’s just the direct in-html styling and conciseness. I’m a simple man
- Ripple UI
- Preline UI
- Hyper UI
- Flowbite, and
- Daisy UI
For many, Typescript / Tailwind simplifies the code, even though it has to be compiled.
Also as the project got larger there was a lot of issues with like "Wait, why isn't this loading? Oh man someone changed the name of a div I was using".
It's just not as clear when things stop working compared to most JS frameworks (which I hate, hence my interesting in HTMX).
I think for smaller projects it can be decent though.
This would solve a couple potential issues:
- Identifying that the element is used for HTMX swaps
- Warning anyone that changing this attribute will break said HTMX swap
Could you not fetch that data separately from the patterns htmx provides and do some light parsing/rendering logic client-side?
The ids changing is annoying tho!
If you think that's easy then you'll love HTMX
[1]: https://pentacent.com/blog/date-time-inputs-with-alpine-js/
SQLite adds an extra level of simplicity and convenience that I can't endorse enough
I grew up in the LAMP world, throw in laravel, and I can basically copypaste and whip stuff up.
I know Apache isnt cool anymore, but I can do all sorts of crazy stuff with it after using it for 15 years. I'm not opposed to change from mariadb/mysql since the syntax is the same.
I dread switching from laravel though. Maybe I should since I hate debugging php... and Laravel major versions are so destructive that basic outdated tutorials will have you frustrated.
I mentioned Go + htmx in my original comment because I use Go at work and we do a lot of templating with the .gohtml and I absolautly love it. The ecosystem of go is what I love about it most
Although I do get tempted by shiny things often; I try to remind myself to stick to a couple tools/languages
Any tips or advice on trying to use SQLite for web dev? What platforms do you use for deploying web apps with SQLite ?
Using the WAL mode [1] you can have truly concurrent reads alongside writes. You can't do truly concurrent writes, however, but the database driver you use (may) automatically retry writes that fail due to locks automatically. The Python driver [2] does with the `timeout` configuration parameter for 5 seconds by default. As your writes should be very quick, so long as you don't hold transactions open or attempt to do lots of work in a transaction, you may find that it's perfectly performant for your use case / usage loads.
1 - https://www.sqlite.org/wal.html
2 - https://docs.python.org/3.11/library/sqlite3.html#sqlite3.co...
Using htmx will be breath of fresh air if you’ve ever had to deal with complex dependency issues
On another note, +1 to Phoenix LiveView if that stack can work for you.
Would be interesting to know which other CMS'es make use of htmx (and to what degree).
One of the best technical decisions we took.
There is a bit of challenge with separation of concern as the team gets bigger, but definitely worth it.
Given this, it makes sense to me that HTMX is popular amongst Django developers especially.
EDIT: under frameworks https://trends.builtwith.com/framework/Remix
<button hx-post="/api/data" hx-swap="outerHTML" hx-trigger="click" hx-ext="localStorageHandler">Save Data</button>
<script> function localStorageHandler(element) { // Get the input value const inputValue = document.getElementById('inputField').value;
// Save the value to localStorage
localStorage.setItem('myData', inputValue);
}
</script>E.g., this lists Htmx as being used in 143 of the top 100k sites, but in the graph it’s currently at or just below 100 on the Y axis.
If you just want something that achieves the goal, without bringing new skills or dependencies, HTMX is the way.
I've used HTMX with Alpine for a backend application, and they help on making the application more dynamic, along with Tailwindcss a lot of the frontend effort is complete.
This is a completely different sense of enjoyment, try to build a reactive modal element that displays a form in it where there is reactive value from the server.
HTMX may work well for many websites though, especially if they are using mostly static content with limited interactivity.
Alpine enables client-side reactivity and does not require a round-trip to the server. Say, clicking a button and incrementing a counter on the page.
HTMX enables something more akin to server-side reactivity. You could use it to modify, say, a single element in a list of elements. The crucial difference is that HTMX makes a call to a server. This means you would use it when you need to read/write data to/from the server.
Alpine provides client-side reactivity. HTMX provides server-side reactivity.