[HN Gopher] Is Htmx Gaining in Popularity?
       ___________________________________________________________________
        
       Is Htmx Gaining in Popularity?
        
       Author : andrewfromx
       Score  : 46 points
       Date   : 2023-07-08 21:10 UTC (1 hours ago)
        
 (HTM) web link (trends.builtwith.com)
 (TXT) w3m dump (trends.builtwith.com)
        
       | andix wrote:
       | I never worked with HTMX, but I think that frameworks like
       | next.js or Astro, that can render server side and client side
       | with the same code, are superior.
       | 
       | HTMX may work well for many websites though, especially if they
       | are using mostly static content with limited interactivity.
        
       | andrewfromx wrote:
       | wondering if that up and to the right is going to continue? Is it
       | winning?
        
         | CharlesW wrote:
         | According to that site htmx is used on 7,188 "currently live"
         | websites, which is 0.008% of jQuery's installed base, and
         | around half the number who've starred it on GitHub. So yes,
         | htmx is winning.
        
       | absoluteunit1 wrote:
       | I've also noticed a rise in programming content creators
       | discussing it.
       | 
       | 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
        
         | robertoandred wrote:
         | No dependencies, except for htmx and whatever else you need to
         | make it work.
        
         | DoesntMatter22 wrote:
         | I used it on a project and I liked it but then I got into
         | situations where I needed to pass a bunch of data back to the
         | rendering page and it got really messy. The author says on the
         | HTMX page that if you have this type of situation then HTMX is
         | probably not the greatest fit.
         | 
         | 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.
        
           | ecshafer wrote:
           | It sounds like in a bigger project a simple linter which
           | checks that front end htmx and backend htmx tags have a match
           | would solve that issue.
        
           | arcanemachiner wrote:
           | I think it would be a good idea in these situations (many
           | cooks in the kitchen) to use a data attribute for each HTML
           | element that uses HTMX, such as `data-htmx-id` to reference
           | your elements instead of just using the `id` attribute (which
           | already carries a lot of contextual baggage).
           | 
           | 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
        
           | mostlysimilar wrote:
           | > I got into situations where I needed to pass a bunch of
           | data back to the rendering page and it got really messy.
           | 
           | Could you not fetch that data separately from the patterns
           | htmx provides and do some light parsing/rendering logic
           | client-side?
        
       | riidom wrote:
       | I checked one website in that list, it uses CraftCMS, which
       | apparently has htmx bundled.
       | (https://github.com/craftcms/cms/tree/main/src/web/assets/htm...)
       | 
       | Would be interesting to know which other CMS'es make use of htmx
       | (and to what degree).
        
         | pacifika wrote:
         | I started a WordPress integration.
         | https://github.com/svandragt/htmxpress Early days but there is
         | some interest.
        
       | pictur wrote:
       | Instead of this ridiculous package, you can use packages with
       | more stable specifications such as alpine.
        
         | arcanemachiner wrote:
         | I've seen this misconception a lot, but HTMX and Alpine do two
         | different things.
         | 
         | 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.
        
       | slig wrote:
       | Fireship published a short video about it couple of days ago.
       | Hopefully it'll gain even more popularity.
        
         | Share6323 wrote:
         | I'm sure that will give it a boost on github. He's influence is
         | quite big for people who are just starting out.
        
           | icpmacdo wrote:
           | I've gleaned value from many of those 100 second explainers
           | video
        
       ___________________________________________________________________
       (page generated 2023-07-08 23:00 UTC)