Live data from Hacker News

Htmx – high power tools for HTML

htmx.org

151–160 of 175 posts

Re: Htmx – high power tools for HTML

#151
post #94

One of the problems I see is that now anyone that was using intercooler is using an outdated and quite likely to become unmaintained library and be forced to migrate/rewrite things.

Yes, I wish the author will offer a smooth upgrade path for the existing intercooler.js users, because my heard wants such a thing to be adopted by people. I like the concept very much!

Re: Htmx – high power tools for HTML

#152
post #76
post #69

This looks amazing -- seems like you can accomplish a significant amount of what constitutes front-end work these days with htmx. The examples are compelling: https://htmx.org/examples/ There is a slight deal-breaker for me. Much of the functionality revolves around hx-swap'ing i.e. writing the contents of a response as HTML into/around tags. This requires the server-side to return HTML instead of JSON. From the docs…

On a related note, I recently discovered that when you use semantically styled HTML, the difference between a JSON payload and an HTML payload is almost negligible (basically, the close tags). Why not transmit in a format that the browser already understands natively?

Maybe one could make a service worker to intercept and transform the JSON to HTML.

Re: Htmx – high power tools for HTML

#153
post #150

I wish some of this ( or All of it ) are implemented inside browser and no longer need any Javascript to function. Web App still has its place. But 90% of the web are Web Pages or Interactive Web Page, not Apps. While Every time I point this out there will be someone stating Gmail as an example of Web Apps, but we will soon have Hey.com to prove it doesn't need to be that way. However browser vendors and standards bo…

Apart from Apple who stand to gain the most from killing off web apps. And Google who are busy trying to make the web redundant (with AMP and much of their other stack).

It's actually web app developers doing the most to push the web in the direction of web apps.

Re: Htmx – high power tools for HTML

#154
post #150

I wish some of this ( or All of it ) are implemented inside browser and no longer need any Javascript to function. Web App still has its place. But 90% of the web are Web Pages or Interactive Web Page, not Apps. While Every time I point this out there will be someone stating Gmail as an example of Web Apps, but we will soon have Hey.com to prove it doesn't need to be that way. However browser vendors and standards bo…

I've been mentioning this together with a very slimmed down html5 for a while now:

- make something close to an html5 equivalent to asm.js: remove all ambiguous variants, everything we know is slow.

- "ban" all Javascript except some small pre-defined libraries like this.

- make a catchy name (html-core? web-core?) and a validator for it. Call it a standard.

It will be fast in all browsers, maybe really fast in browsers that care to optimize for it.

If it becomes a thing we can create new simpler pure web browsers (as opposed to todays application platforms that we will then start calling old or legacy html :-)

Re: Htmx – high power tools for HTML

#155
I wish Intercooler and htmx were more popular. But I think that practical examples, copy and pastable code, youtube tuts are keys for a library to succeed. Think about php manual, react... There's often no need for some websites to bring big frameworks but they're well documented. That's the new nobody ever got fired for buying IBM.

Re: Htmx – high power tools for HTML

#156
post #148

Earlier quoted context omitted.

> How does one use this for AJAX without rewriting existing backends? I've never actually used a backend that couldn't return arbitrary content types. Those exist?

> Those exist? For sure. Most of the backends we write only return JSON. If you request HTML or any other content-type, we return nothing. We just don't implement it. If you write your backend from scratch and only intend for it to be used only with your web front-end, you can make it return bits of HTML (I have several applications in jQuery that work like this -- the value of the response just gets inserted via ("#…

But it could

Re: Htmx – high power tools for HTML

#157

hello, I'm the creator of htmx (and originally intercooler) I just released 0.0.4, so htmx is still very young, but it's got a decent test suite: https://htmx.org/test/0.0.4/test/ there is a nice extension mechanism: https://htmx.org/extensions/ and some very rough docs on how to pull off pure HTML animations: https://htmx.org/examples/animations/ happy to answer questions

What about accessibility? It'd be great to see the docs and examples put more focus on accessibility, both for non-JS clients and for clients that may be better served by not replacing elements, like screen readers. And, based on some of the comments here, it seems like some people may have forgotten how to do anything that doesn't depend on AJAX. ;-)

The folks around these parts give me a great sense of job security.

Re: Htmx – high power tools for HTML

#158
post #76

Earlier quoted context omitted.

On a related note, I recently discovered that when you use semantically styled HTML, the difference between a JSON payload and an HTML payload is almost negligible (basically, the close tags). Why not transmit in a format that the browser already understands natively?

Maybe one could make a service worker to intercept and transform the JSON to HTML.

That is a really interesting place to stick what amounts to a template engine. Not saying it is right or wrong. Just very interesting.

Re: Htmx – high power tools for HTML

#159

Earlier quoted context omitted.

This is exactly the use-case for Content-Type and Accept headers. The client and server negotiates what type of content they can receive/send, so if you're sending application/json as the Accept header, you can only handle application/json, if you only send text/html in the header, then only HTML. If the client understands both, you do application/json,text/html. with the order signalling preference. Any serious fram…

THat's how you negotiate the content type; the original question was how they have a service returning json return html. I've never heard of a framework that can arbitrarily convert data into HTML - how would that even work?

You could dynamically create HTML that mirrored a JSON response. You'd just have to have to walk the JSON structure and create a structure for where the key and the value from the JSON end up. Each node could just be a . The ID could be a composition of the key and the parent nodes/keys so that it'd be unique. You could also stuff both values in a data-* attribute.

It wouldn't be the prettiest HTML but you could work with it via CSS and JS.

Re: Htmx – high power tools for HTML

#160
post #148

Earlier quoted context omitted.

> Those exist? For sure. Most of the backends we write only return JSON. If you request HTML or any other content-type, we return nothing. We just don't implement it. If you write your backend from scratch and only intend for it to be used only with your web front-end, you can make it return bits of HTML (I have several applications in jQuery that work like this -- the value of the response just gets inserted via ("#…

But it could

Sure but it’s extra engineering time (tiny per instance yes but multiplied over many legacy apps with no value add — not an easy business case to make just to use a html based front end library.)

Much easier to use client-side templating as suggested by the author.

Post reply on HN