Live data from Hacker News

Htmx in a Nutshell

htmx.org

381–390 of 414 posts

Re: Htmx in a Nutshell

#381
This is another project that teaches you to write non-standard, invalid code, with the hopes that a tool will come along and transform it into valid, standard code later.

And there's no need, because there are multiple ways in HTML they could already express this without violating HTML. Here are 2 ways that work, and then the way they've done it which is in violation:

Possible method 1: Data attributes. Any time you as an author want to add additional data to an element, you are free to invent any custom attribute names you want, so long as they begin with "data-".

Possible method 2: Custom elements. Any time you as an author want to add a custom element to HTML, you are free to invent any tag name so long as it follows a simple naming criteria (essentially [a-z]+-[a-z]+) and if you invent any custom element, you are allowed to define whatever attributes on it you like.

Invalid method chosen: To pollute standard elements with invalid attribute names in violation of the HTML standard.

Re: Htmx in a Nutshell

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

If you like the simplicity of html-based development, also try out https://github.com/beenotung/data-template

Re: Htmx in a Nutshell

#383
post #381

This is another project that teaches you to write non-standard, invalid code, with the hopes that a tool will come along and transform it into valid, standard code later. And there's no need, because there are multiple ways in HTML they could already express this without violating HTML. Here are 2 ways that work, and then the way they've done it which is in violation: Possible method 1: Data attributes. Any time you…

> Possible method 1: Data attributes. Any time you as an author want to add additional data to an element, you are free to invent any custom attribute names you want, so long as they begin with "data-".

From the linked docs:

> It's worth mentioning that, if you prefer, you can use the data- prefix when using htmx:

    Click Me!

Re: Htmx in a Nutshell

#384
post #381

This is another project that teaches you to write non-standard, invalid code, with the hopes that a tool will come along and transform it into valid, standard code later. And there's no need, because there are multiple ways in HTML they could already express this without violating HTML. Here are 2 ways that work, and then the way they've done it which is in violation: Possible method 1: Data attributes. Any time you…

Given the documentation actually list the data-* syntax as an alternative (and pretty much near the top), I’m assuming they are aware of the problem, but still prefer the non-standard-compliant attributes.

Re: Htmx in a Nutshell

#385

Earlier quoted context omitted.

> But if you disable JavaScript, then htmx won't work either, right? It would work if either HTMX became standardized and implemented by the browser, or if I could allow HTMX (the JS) and not other scripts [selectively].

See… that would be interesting and useful. But it’s not what’s on the table here.

It's called baby steps. Implement the HTML extensions you want using JS, then get them standardized. You could do it w/o the PoC first, but then it might be harder to get the mindshare and traction you need to get the W3C to go with it.

Even if the W3C rejects this, it would still be useful for many who want to write declarative scripts rather than actual JS.

Why does CSS exist anyways? Because it's a declarative language, and declarative languages are clearly better for certain tasks. HTML itself is declarative.

Re: Htmx in a Nutshell

#386
post #383
post #381

This is another project that teaches you to write non-standard, invalid code, with the hopes that a tool will come along and transform it into valid, standard code later. And there's no need, because there are multiple ways in HTML they could already express this without violating HTML. Here are 2 ways that work, and then the way they've done it which is in violation: Possible method 1: Data attributes. Any time you…

> Possible method 1: Data attributes. Any time you as an author want to add additional data to an element, you are free to invent any custom attribute names you want, so long as they begin with "data-". From the linked docs: > It's worth mentioning that, if you prefer, you can use the data- prefix when using htmx: Click Me!

Why promote and illustrate a non-standard way, or even allow it at all?

Re: Htmx in a Nutshell

#387

Earlier quoted context omitted.

Wait till you end up on a fever swamp project involving templated HTML generation. Or even a fever swamp project involving jQuery.

I’ve built those sorts of apps for 20+ years. For me, the Rails / Flask type approach is much easier to work with.

I invite you to work on a Java Server Faces project sometime. Or anything with "Portlets".

Anything you have 20 years of experience with is going to be pretty easy for you, no surprise there.

Re: Htmx in a Nutshell

#388
post #386
post #383

Earlier quoted context omitted.

> Possible method 1: Data attributes. Any time you as an author want to add additional data to an element, you are free to invent any custom attribute names you want, so long as they begin with "data-". From the linked docs: > It's worth mentioning that, if you prefer, you can use the data- prefix when using htmx: Click Me!

Why promote and illustrate a non-standard way, or even allow it at all?

For those people that like to have less verbosity at the expense of composing invalid HTML?

TypeScript is an invalid form of JS but people still like it.

Re: Htmx in a Nutshell

#389

From the page: > It's worth mentioning that, if you prefer, you can use the data- prefix when using htmx Why is this worth mentioning and what difference does adding the prefix make?

To avoid your editor from puking with bunch of invalid HTML markups?

Re: Htmx in a Nutshell

#390

while I like htmx it's really for SSR frameworks specifically for django as rails has hotwire and laravel has livewire all do similar things. then you have alpine.js that is more a simple jquery for frontend js work. if you do django, use htmx, I'm not sure how it works for other scenarios. For rich desktop like apps, SPA is still probably the only option.

How is htmx tied to a specific backend language?

How does htmx differ against hotwire and livewire?

Post reply on HN