[HN Gopher] Htmx 2.0.0 has been released
       ___________________________________________________________________
        
       Htmx 2.0.0 has been released
        
       Author : lsferreira42
       Score  : 321 points
       Date   : 2024-06-17 19:10 UTC (3 hours ago)
        
 (HTM) web link (htmx.org)
 (TXT) w3m dump (htmx.org)
        
       | recursivedoubts wrote:
       | hey folks, i'm the creator of htmx
       | 
       | this isn't much of a feature upgrade, but we took the opportunity
       | to clean up a few things and drop IE support, which will help us
       | slim down the library over time
       | 
       | hopefully it's an easy upgrade for most htmx users, upgrade guide
       | is here:
       | 
       | https://htmx.org/migration-guide-htmx-1/
       | 
       | happy to answer any questions
        
         | DLA wrote:
         | Huge congrats on the major number release. HTMX is simply
         | wonderful. Using it for a major project as we speak!
        
           | jack_riminton wrote:
           | Would love to hear more about how you're using it
        
         | bun_terminator wrote:
         | Thank you. htmx has me (a c++ dev) back in the web game. I can
         | finally build entire web frontends without a single line of
         | explicit js.
        
           | recursivedoubts wrote:
           | really great to hear, i love that htmx helps folks that have
           | been knocked out of web development get back into it
        
         | gws wrote:
         | No question but I wanted to say, I was pulling my hair out
         | trying to figure out which js framework was less of an
         | overkill, and finding htmx was pure joy
        
           | recursivedoubts wrote:
           | :) that's great to hear, i hope you find it useful
        
         | gaganyaan wrote:
         | Are there any efforts to push functionality like this into the
         | HTML standard? It would be nice if htmx eventually became
         | unnecessary as browsers implemented it, and the work you're
         | doing with proving it out in the wild seems like a crucial part
         | of that.
        
           | recursivedoubts wrote:
           | yes, there are, alex petros, an htmx maintainer, gave a talk
           | at Big Sky Dev Con on the shortest path to htmx-like
           | functionality in HTML here:
           | 
           | https://www.youtube.com/watch?v=inRB6ull5WQ
           | 
           | we are talking w/the chrome developers about these ideas, i'm
           | cautiously optimistic
        
             | Alifatisk wrote:
             | > we are talking w/the chrome developers about these ideas
             | 
             | I hope this does not become a chrome-only feature in that
             | case
        
               | recursivedoubts wrote:
               | agreed, but the chrome team is in communication w/the
               | other browser makers and often drives new standards (e.g.
               | https://developer.mozilla.org/en-
               | US/docs/Web/API/View_Transi...)
               | 
               | their latest features have started leaning into improving
               | the hypermedia infrastructure of the web so i'm
               | optimistic
        
             | asimops wrote:
             | Do you also plan on talking with the Mozilla people? And
             | with Apple? Or will this be a kind of big daddy Google
             | knows what's best for you, ads included?
        
               | recursivedoubts wrote:
               | I don't have contacts in those groups, but chrome is in
               | contact w/them and has pushed forward hypermedia-friendly
               | features e.g. https://developer.mozilla.org/en-
               | US/docs/Web/API/View_Transi...
               | 
               | i have told my chrome team contacts about bugs in other
               | browsers (e.g. safari not properly updating completion
               | results when datalist elements are replaced
               | asynchronously) and they have communicated these issues
               | to those teams and gotten them fixed
               | 
               | if anyone reading this from other browser teams is
               | interested in getting in contact w/me they can email me
               | at carson at bigsky dot software
        
         | jpgvm wrote:
         | As someone that has long since soured on frontend things
         | despite having tried everything from the start - mootools,
         | jQuery, backbone.js, SproutCore, Ember, React, Vue, etc.
         | 
         | I genuinely think htmx is the only one I have liked even after
         | I built something substantial in it.
         | 
         | To me that is big, to be able to walk away from a significant
         | amount of time with something and say "yeah! I want to use that
         | again!" instead of some variant of "it's the least bad option"
         | is both rare and cherished so thanks for all the hard work.
        
           | recursivedoubts wrote:
           | :) glad to hear it, definitely appeals to some people (and
           | disgusts some other people!)
        
         | llmblockchain wrote:
         | Does this release have head-support built in or still requires
         | an extension? I thought 2.0 was going to release with head
         | support...
        
           | recursivedoubts wrote:
           | we went back and forth on it but ultimately concluded that it
           | bloated the core too much so we kept it as an extension
        
             | highpost wrote:
             | https://htmx.org/extensions/head-support/
             | 
             | is returning 404.
        
               | nop_slide wrote:
               | Looks like it moved to here
               | 
               | https://extensions.htmx.org/
               | 
               | But this is weirdly hard to find on the new site as
               | searching just opens a scoped google search.
               | 
               | Probably would be good to setup redirects to the new
               | extensions site.
        
               | recursivedoubts wrote:
               | yes, need to improve that aspect of the docs, sorry!
        
               | nop_slide wrote:
               | no need to apologize :)
               | 
               | big congrats on the launch!
        
             | llmblockchain wrote:
             | As long as hx-boost is in core, it would make more sense to
             | have head support in core? It's difficult to really
             | leverage hx-boost without being able to manage the head in
             | responses.
        
               | recursivedoubts wrote:
               | yeah, i go back and forth on it a lot
               | 
               | could still fold it in at some point in the 2.x line!
        
         | dpe82 wrote:
         | Thanks for all your hard work; htmx is a breath of fresh air
         | and an escape from the morass of needless complexity.
         | 
         | My only question: how can I get a set of those sweet sweet
         | floppy disks?
        
           | recursivedoubts wrote:
           | working on it, need to see if the disk guy will dropship
        
         | lenkite wrote:
         | What is your opinion on https://github.com/unpoly/unpoly as a
         | competitor ?
        
           | recursivedoubts wrote:
           | unpoly is a great library that sets the standard for
           | progressive enhancement
           | 
           | i often recommend it for people that want a more "batteries
           | included" hypermedia-oriented library
        
         | nickpeterson wrote:
         | Another, "I really like htmx" comment, currently using it for
         | an internal corporate webapp, it's great.
        
         | emmanueloga_ wrote:
         | Oddly specific. Why implementing "forEach" and "toArray"
         | instead of using the functions from Array.prototype? [1] I can
         | see `Array.from` used elsewhere on the code.
         | 
         | ---
         | 
         | 1:
         | https://github.com/bigskysoftware/htmx/blob/master/src/htmx....
        
           | recursivedoubts wrote:
           | IE support, haven't removed some of the shims, planning on
           | doing so over time
        
         | aquariusDue wrote:
         | I'll join the others in praise of HTMX, it's a joy adding
         | dynamic functionality to any website now. Thank you!
        
         | jmorgan wrote:
         | Thank you for building htmx!
        
         | mrinterweb wrote:
         | Do the docs https://htmx.org/docs/ reflect 2.0 or 1.x?
        
           | recursivedoubts wrote:
           | 2.x
        
         | droptablemain wrote:
         | He's the creator, but not the CEO. That title belongs to
         | me...and you.
        
           | recursivedoubts wrote:
           | so true
           | 
           | https://htmx.ceo
        
         | logankeenan wrote:
         | Have you considered replacing xhr with fetch? I believe it
         | would allow htmx to be used in even more places. Fetch can be
         | hijacked so returning data to the htmx framework isn't limited
         | to the network. You could "run" a server in the browser or have
         | a native app render HTML as well.
         | 
         | Perhaps, there's already a good way to hijack xhr that I'm
         | unaware of too.
         | 
         | Edit: Relevant link: https://logankeenan.com/posts/client-side-
         | server-with-rust-a...
        
           | recursivedoubts wrote:
           | yeah, looked at it, unfortunately fetch() and xhr have a non-
           | intersecting set of features (in particular, upload progress
           | for xhr) so we decided not to touch it
           | 
           | i may restructure the internals to allow for mocking out
           | responses using events, it comes up, especially w/ extensions
        
             | logankeenan wrote:
             | That'd be great, and I'd love to help in any way I can!
             | Feel free to @mention me on Github.
             | https://github.com/logankeenan
             | 
             | Thanks for making htmx!
        
       | jerrygenser wrote:
       | Love the upgrade music. Wish more libraries would add upgrade
       | music with major releases
        
         | callalex wrote:
         | I looked around but I can't find the upgrade music you are
         | referencing.
        
           | elchief wrote:
           | bottom of this page: https://htmx.org/migration-guide-htmx-1/
        
       | jph00 wrote:
       | I just want to take advantage of this news to say: I love HTMX so
       | much! :D It makes web development fun again. I can still use all
       | the fancy js libs I want -- but my main logic lives on the
       | server, using plain HTTP and HTML. Really clear and simple.
        
       | Devasta wrote:
       | HTMX is like a glimpse into the road not taken, where HTML is the
       | main language of the web instead of JS. Sometimes the grass
       | really is greener on the other side, and I hope as an industry we
       | make the switch.
        
         | kyrra wrote:
         | I believe he makes some good arguments that we really still
         | need both, but HTML could be more powerful and allow for less
         | JS.
         | 
         | This is a good essay on the topic:
         | https://htmx.org/essays/when-to-use-hypermedia/
         | 
         | Definitely one place htmx can be abused is oob-swap:
         | https://htmx.org/attributes/hx-swap-oob/, which allows any
         | given HTMX request to replace any part of the page. It sort of
         | destroys the concept of locality of concern that HTMX pushes
         | for.
        
         | oblio wrote:
         | My cynical take: this is by design. Those web committees are
         | staffed by companies that each have their non-web platform
         | they're pushing (or were, until it died, see Microsoft), so
         | even the most well meaning members are somehow contorted into
         | compromises that make the web as a platform a bad technical
         | choice in terms of actual design, but the best one in terms of
         | flexibility and of course ubiquity.
         | 
         | It's completely stupid HTML, by default, doesn't have basic
         | controls found in EVERY UI toolkit since circa 1980. The
         | standard examples being ListView and TreeView.
        
           | jwells89 wrote:
           | > It's completely stupid HTML, by default, doesn't have basic
           | controls found in EVERY UI toolkit since circa 1980. The
           | standard examples being ListView and TreeView.
           | 
           | This is one of my greatest frustrations with the web as a
           | platform. These controls are so basic they should just _be
           | there_ , eliminating the need to sift through dozens of
           | third-party implementations all with wildly varying feature
           | sets, performance profiles, framework compatibility, levels
           | of upkeep, etc to find one that works for your project.
        
             | oblio wrote:
             | Well, they're not, and I can't find any good reason for why
             | they aren't, when we're putting entire GPUs languages in
             | there, except for the fact that somewhere in the HQ of one
             | or more of those companies guiding web standards there is a
             | discussion that goes something like:
             | 
             | Web Platform Dev: Boss, can we add TreeView to HMTL?
             | 
             | Web Platform Boss: Sounds cool, what are the advantages and
             | disadvantages of doing this?
             | 
             | Web Platform Dev: Advantage: cross platform widget that's
             | going to be super useful to many developers, replacing 3rd
             | party ones of varying quality. Disadvantage: would take N
             | months to implement and M years to have full adoptions, and
             | yeah, it would probably increase adoption of the web
             | platform, maybe even on mobile platform, where there is a
             | chance that indirectly we will lose about $1-2bn per year
             | from our walled garden, coupled with other web platform
             | enhancements we should also make, regarding progressive web
             | apps, local storage, etc.
             | 
             | Walled Garden Boss: Hey, SVP, can we please FIRE Web
             | Platform Dev and Web Platform Boss as what they said
             | amounts to a 2% drop in our share price?
        
           | maigret wrote:
           | Don't attribute to malice... Many people working on frontend
           | came from application or backend development and preferred
           | the JavaScript model to a more declarative one. Not
           | understanding enough the document context that drives the
           | web. This makes everything more fragile and slow but hey
           | "functionality" wins over everything else in todays world.
        
             | oblio wrote:
             | This doesn't explain ListView and TreeView. Or the lack of
             | a DatePicker widget.
             | 
             | Look at Windows, MacOS, iOS, Android, Gtk, Qt.
             | 
             | Which of those doesn't have these widgets?
             | 
             | I'm tired of defending mega corps with thousands of
             | employees with IQs through the roof, working on this for
             | decades. It has to be latent malice. Banality of evil, if
             | you will.
        
       | kyrra wrote:
       | I thought the 2.0.0 release was a bit of a joke from the
       | BigSkyDev conference, as he was doing stuff like this:
       | 
       | https://twitter.com/htmx_org/status/1799661735781261592
       | 
       | There's even some sweet ascii art on the disk:
       | https://twitter.com/jcs224/status/1799586838161621339
       | 
       | Great to see the continued love of this framework. (don't throw
       | anything at me)
        
         | recursivedoubts wrote:
         | released exclusively on floppy disk for the first week! :)
        
       | fghfgh65h5 wrote:
       | HTMX + static site generators is DOPE. If we had just these two
       | things back in the 90's...
        
         | baggachipz wrote:
         | I'm probably totally ignorant, but how would htmx work with a
         | static site generator? Isn't the whole point of htmx that it
         | extends the front end to dynamically interact with the server
         | and get responses to inject?
        
           | hedgehog wrote:
           | On a documentation site, photo gallery, etc, it is very
           | reasonable to use something like htmx to implement navigation
           | without triggering full page loads.
        
           | mbreese wrote:
           | You could have static elements pre-rendered, but only loaded
           | on demand. For example, if you had a blog with comments, you
           | could have the comments pre rendered in htmx fragments, but
           | only loaded when they are clicked.
           | 
           | Or a photo gallery with thumbnails that are enlarged when
           | clicked.
           | 
           | At least, that's one way it could work.
        
           | victorbjorklund wrote:
           | I used it on a couple of static sites. Sometimes you just
           | want that "SPA" navigation without a full page reload but you
           | dont need a full JS framework
        
         | baq wrote:
         | we did... almost in the 90s.
         | 
         | one example which I distinctively remember using before AJAX
         | was a word:
         | https://github.com/twisted/nevow/blob/master/nevow/stan.py
        
       | recursivedoubts wrote:
       | @dang, i know there is an htmx filter on HN due to so many posts,
       | but it'd be nice if this one could go to the top, it's a major
       | release
        
         | jack_riminton wrote:
         | +1, if there's so many posts then there's clearly pent up
         | demand to talk about it
        
       | ctxcode wrote:
       | i havent used htmx yet, but it sounds like a breath of fresh air.
       | no npm library with 1000 dependencies with slow build times. just
       | plain simple js library like the good old days ^_^
        
       | wruza wrote:
       | Htmx users, can you please share your backend stacks and
       | approaches? Me specifically interested in templaters for node
       | (+ts) and your thoughts on endpoint management, but all ideas are
       | welcome I guess.
        
         | Raticus79 wrote:
         | I'll be trying things out with FastAPI and Jinja templating
        
         | simonbarker87 wrote:
         | NestJS with Handlebars templates. I don't love Handlebars but I
         | have past experience with it so was the most pragmatic choice.
         | 
         | I'm interested in trying EdgeJS as a templating alternative to
         | HB but haven't got round to it yet.
         | 
         | I've added a NestJS error handler that looks to see if the
         | request came from an htmx request and then serve the error
         | response as html, if not then it sends back json since I do
         | have json api end points as well in the back end.
        
         | pondidum wrote:
         | Go: go templates and fiber for http serving. I have a mini
         | framework for adding some structure to the templates (folder
         | per feature: contains controller, templates, etc, and some
         | naming conventions)
        
           | Art9681 wrote:
           | This is my stack as well and it works great.
        
         | fprotthetarball wrote:
         | My backend for a simple web application I'm working on is
         | entirely in Rust. Highlights:
         | 
         | - axum: web application framework - https://github.com/tokio-
         | rs/axum
         | 
         | - axum-htmx: axum extractors, responders, guards for htmx -
         | https://github.com/robertwayne/axum-htmx
         | 
         | - rusqlite: SQLite bindings -
         | https://github.com/rusqlite/rusqlite
         | 
         | - maud: HTML templating as a macro - https://maud.lambda.xyz
         | 
         | The way maud lets you compose markup works very nicely with
         | htmx. The HX-Request header lets you know if the request is
         | coming from htmx or if it is a regular request. You either call
         | the top-level function if it's a regular request to get the
         | entire page rendered, or call a subset of functions to get the
         | appropriate partial rendered if it's an htmx request.
         | 
         | It's also nice to easily have tests for the rendered pages. My
         | unit tests cover verification of the rendered HTML, too.
        
       | simonbarker87 wrote:
       | One of the happiest days of coding in the last 10 years for me
       | happened in September last year when I added htmx to an internal
       | self serve web app I develop for our company. With the addition
       | of maybe 5 htmx attributes I was able to delete about 500 lines
       | of client side JS.
       | 
       | The app is now chock full of htmx interactions and has very
       | little client side JS for the size of the app and it's a joy to
       | work on.
       | 
       | Without htmx I would not be able to turn around features as
       | quickly as I do for the wider team so thank you, thank you, thank
       | you.
       | 
       | I've been in web dev for 20 years and this feels like what we
       | should have made all along.
       | 
       | The one area I would like to see some development is the file
       | upload experience, I've had to do something a bit weird to get
       | htmx and dropzone playing nice.
        
         | cztomsik wrote:
         | can you comment on what those 500 lines actually were?
         | react+redux?
        
           | smegsicle wrote:
           | all htmx does is replace divs on the page, so probably just
           | code that did that
        
       | mikemitchelldev wrote:
       | React's had such dominance for the last 10 years. I'm glad
       | there's an alternative.
        
       | jononor wrote:
       | Has anyone here used htmx for embedded devices? That is to
       | provide web UI served by the device, for configuration / data
       | access / control? Can you share the experience and if you would
       | use it again?
        
       | digitalsin wrote:
       | It has already been pirated by various groups and made available
       | for download assuming you have the bandwidth. Unbelievable. Big
       | Sky has to make money somewhere.
        
         | recursivedoubts wrote:
         | unfair!
        
       | xakpc wrote:
       | as htmx CEO I approve this message
        
       | xakpc wrote:
       | htmx works great with dotnet btw (wrote a series on that)
        
       ___________________________________________________________________
       (page generated 2024-06-17 23:02 UTC)