Live data from Hacker News

Htmx in a Nutshell

htmx.org

271–280 of 414 posts

Re: Htmx in a Nutshell

#271

Can anyone with experience in both talk about how stimulus and htmx compare? Or why they don't?

Apples to Oranges

You'd be better off comparing https://mrujs.com to HTMX

Stimulus is a way to attach behaviours to DOM elements. It has no remote concept and no rendering concept. It's freaking awesome, IMO. But it has nothing to do with the problems HTMX wants to solve.

Re: Htmx in a Nutshell

#272
post #100

I like gymzaal and hyperscript - they solve few cases but those cover something like 99% of what a average app needs. My biggest pain point lies with the docs, there are not many of them and it takes time to figure out what’s happening For example, there was no simple way to understand that both libraries are loaded correctly, also it wasn’t immediately obvious where to use htmx and where to start using hyperscript

gymzaal = htmx, autocorrection lol

Re: Htmx in a Nutshell

#273
post #4

Makes me smile because everything old is new again. This is very similar to features MooTools had like 10+ years ago before JSON took off big.

Makes me smile too. Around 2008 while I was at Yahoo! I built a standalone library called Dhaka (literally stuck a pin in a map and used the place name as the project name) that did almost exactly this. It was used on a few of the EU sites but I left before I got chance to open source it. The problem I was trying to solve was eliminating a bunch of duplicate JavaScript that was essentially sending/fetching data to/fr…

Or in a similar vein I remember Github making a mediumly big deal years and years ago about having no-reload moving between pages of the directory tree within a repo with... I think their library was called pjax? And it fetched some partial HTML from the server and updated a container, plus having some pushState/popState to make it work with browser history.

The most interesting part of it to me is that the mainstream has gotten so far out over to react and data payloads that the paradigm of "send some HTML and stick it in a container" is seen as revolutionary. Not to say that a well-designed library for doing this is a bad idea, just that... it's interesting to see how it's talked about.

Re: Htmx in a Nutshell

#276

Earlier quoted context omitted.

I am so tired of everyone complaining about complexity in front end frameworks, as if this sort of thing doesn't exist in other languages and stacks, and as if frontend dev isn't as complex as other domains. Just ignore them or do something else.

> as if this sort of thing doesn't exist in other languages and stacks It doesn't. For example in the Java world and in the last 10 years there were only two "frameworks". Just Spring and Oracle/Java EE Now two more have appeared (Quarkus and Micronaut) bringing the total number of frameworks to 4.

Vaadin? GWT? Not a java guy, may miss some distinctions.

As someone who came into webdev only recently with a long experience in just-development, it feels like there is no problem with frontend at all. The problem is that the frontend industry chose the worst perverted defaults and those defaults pay the most money. That’s the whole drama. It’s just a “five monkeys experiment” sort of situation.

Re: Htmx in a Nutshell

#277
post #3

I am burnt out (but recovering!) with web dev and htmx is what I am using for my project. Django, DRF, Postgres, tailwind and HTMX. I am so tired of all the front end frameworks and all the complexity that gets added. At some point I think you need it and you get returns from it but hearing more people in the industry recognize and talk about how JS everything isn't always the answer gives me hope. I like what HTMX h…

I'm a huge proponent of Tailwind. What I tell people is to ignore their gut impression and just try it out. Equivalently, my first impression of HTMX is that I kind of hate it. But I could see it being similar to Tailwind, where you just need to try it out and then it'll click. Is that fair to say?

I've tried Tailwind, and as a back end dev who only really understands the basics of CSS I find it a bit overwhelming and open ended. Seems it's designed for people with already a really deep knowledge of CSS who can could create beautiful components with it if they wanted but for whom hooking up the CSS to the components is painful. If you aren't good enough to create components with CSS in the first place, seems better to stick with things like bootstrap/bulma no?

Re: Htmx in a Nutshell

#278

I guess it's important to note that in many cases you'll be willing to pair htmx with either alpine.js (using https://htmx.org/extensions/alpine-morph/ ), or with hyperscript ( https://hyperscript.org/ , developed by same team as htmx). Things that don't require request to server - managed by alpine, things that do require - by htmx. There are situations where both tools can be used, one has to pick.

I’ve been looking for alpine and forgot what it was called, have come across it some time ago. I knew I would find it in the comments on this post as it’s kind of like htmx. I didn’t even know the same people made both!

:) I didn't make alpine, that caleb porzio (a genius)

I did make https://hyperscript.org, which is kinda in the same space but very different than pretty much everything else

Re: Htmx in a Nutshell

#279

Have been using htmx for a little over a year now, and I am so thankful for this library. It has simplified our development tremendously from ClojureScript / React to vanilla Clojure on the backend doing SSR of HTML with htmx HTML element attributes. All with 1 script tag that includes this wonderful library. Kudos to the creator of htmx! This is what hypermedia architecture with true HATEOAS is all about. It feels l…

Do you know off hand how much JavaScript your pages are including now versus when you were using ClojureScript/React?

I ask because I know ClojureScript is built on Google Closure which has pretty advanced dead code elimination (and typically for React functionality people use libraries like reagant that take advantage of this - I think?). Presumably with htmx users are having to download the whole htmx lib.

Re: Htmx in a Nutshell

#280
Has anyone cleanly bolted htmx into Flask or another similar Python framework?

I typically use mako for templates and htmx partials or components or whatever you want to call them would seem to cleanly map to mako includes - but I'm not sure how I might connect the render context which is typically collected for the top-level page in a tidy way.

Appreciate hearing others thoughts.

Post reply on HN