Live data from Hacker News

Htmx 2.0.0 has been released

htmx.org

71–80 of 146 posts

Re: Htmx 2.0.0 has been released

#71

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

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...

Re: Htmx 2.0.0 has been released

#72

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

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-…

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

Re: Htmx 2.0.0 has been released

#73

HTMX + static site generators is DOPE. If we had just these two things back in the 90's...

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?

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

Re: Htmx 2.0.0 has been released

#74
post #54

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.

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)

This is my stack as well and it works great.

Re: Htmx 2.0.0 has been released

#75

Earlier quoted context omitted.

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-…

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

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!

Re: Htmx 2.0.0 has been released

#76

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

He's the creator, but not the CEO. That title belongs to me...and you.

so true

https://htmx.ceo

Re: Htmx 2.0.0 has been released

#77

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…

can you comment on what those 500 lines actually were? react+redux?

all htmx does is replace divs on the page, so probably just code that did that

Re: Htmx 2.0.0 has been released

#80
post #54

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.

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.

Post reply on HN