https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • t

    tall-dinner-62086

    11/03/2022, 9:26 AM
    I don't know of a backend that can't return html
  • m

    melodic-advantage-28381

    11/03/2022, 9:57 AM
    Actually things like FastAPI return JSON only by default. Of course you can customize them but I guess if @limited-scientist-86362 is using FastAPI, generating HTML on the server is not a small move like for someone who's using Django for example. @limited-scientist-86362 if you've only worked in the "API/SPA" world, it's normal for you to call the server-side a "backend" and to be surprised that "backend" can return HTML. But actually, the web has been existing for 30 years now, and before Google and Facebook declared war to web development (by creating their monsters and calling anyone who's not using them a grandpa), this "backend" stuff was called a "web server", and 99% of the time it was returning HTML to the browser for it to do its normal job (which is displaying HTML, not running Javascript applications). Major "web frameworks" (and not CMS, which are another thing) have been generating HTML on the server for decades. Some popular examples of these "web frameworks" are Django (Python), Rails (Ruby), Symfony (PHP), SpringBoot (Java), but also Wordpress or Drupal (PHP, which are also CMS). The API/SPA pattern is not the normal way of making a website or even a web application.
  • t

    tall-dinner-62086

    11/03/2022, 10:02 AM
    I was unaware of fastapi. I still remember hosting websites with just some plain html files, my perception of what a webs server is might be somewhat out of sync with the "youth"
  • c

    cuddly-keyboard-70746

    11/03/2022, 11:49 AM
    I personally love to do just that. Besides the group that disables JS on the web (kudos to them) it can also significantly improve the experience of devices with a degraded internet connection as the site will be functional sooner.
  • c

    cuddly-keyboard-70746

    11/03/2022, 11:54 AM
    thats kinda cool. however with hx-method I see some overlap. how do you wrap a patch in a post are you sending a json object in the request? I agree the docs don't dig into progressive enhancement/graceful degradacion that much. The most powerful thing you can do is read the headers, htmx request attach a specific htmx header and you can change your response based on that
  • c

    cuddly-keyboard-70746

    11/03/2022, 11:56 AM
    Jeesh, unless you are very early in your carreer I find it extremely difficult to image coders that aren't aware that backends can return html, it blows my mind. I started my first coding job in 2015 but to be fair my fisr couple of years were server generared (JSF, Thymeleaf)
  • c

    cuddly-keyboard-70746

    11/03/2022, 11:58 AM
    sure, eveybody is sucking facebook's and google's tit and think SPA are amazing and the thing to do, but the leap from there to: "backends can not return html" is wild to me.
  • b

    busy-action-85810

    11/03/2022, 12:39 PM
    **corlaez**: Ah, OK, so I wasn't paying attention to the HTTP Headers used by HTMX. Thanks, that could be useful.
  • m

    melodic-advantage-28381

    11/03/2022, 12:48 PM
    Just the fact that people are calling web servers and application "backend" tells the story of how in their minds the web has shifted from server to browser. Everything that happens on the server has become "backend", which is a nice word for "somebody else's problem". In France there is a training program for people who are changing careers to become web developers: in 3 months, they learn how to make a web application using Ruby on Rails as a "backend" and React as a "frontend". Guys, it's 3 months only, show people that Rails is perfect for creating web applications on its own!
  • b

    bitter-machine-55943

    11/03/2022, 12:51 PM
    Love this comment on orange site. Like HTML is a new thing that not all clients can render yet πŸ˜‚
  • g

    gorgeous-airport-54386

    11/03/2022, 12:51 PM
    how tf do you render json?
  • g

    gorgeous-airport-54386

    11/03/2022, 12:52 PM
    hey check out my new website
  • g

    gorgeous-airport-54386

    11/03/2022, 12:52 PM
    any client can render it
  • b

    bitter-machine-55943

    11/03/2022, 12:55 PM
    Exactly lol. I mean it’s not a lie. Even those people still running a Unix mainframe from 1971 can read your json site
  • f

    freezing-waitress-26396

    11/03/2022, 2:06 PM
    🀣
  • j

    jolly-kite-167

    11/03/2022, 5:47 PM
    generate JSON -> apply
    xml-js
    package -> XML -> apply XSLT -> HTML -> apply CSS. easy peasy. 😐
  • m

    mysterious-toddler-20573

    11/03/2022, 6:05 PM
    how has xslt not morphed into JSON-SLT yet?
  • m

    mysterious-toddler-20573

    11/03/2022, 6:05 PM
    the javascript -> J2EE transformation must be completed
  • m

    mysterious-toddler-20573

    11/03/2022, 6:06 PM
    https://github.com/schibsted/jslt
  • m

    mysterious-toddler-20573

    11/03/2022, 6:06 PM
    LETS GOOOOOOO
  • m

    mysterious-toddler-20573

    11/03/2022, 6:08 PM
    I can't tell if this is real or not: https://twitter.com/slightlylate/status/1587712569438969856
  • m

    mysterious-toddler-20573

    11/03/2022, 6:08 PM
    but if it is, and there is such a thing as React Server Faces, we are very close to the singularity
  • b

    boundless-vase-80440

    11/03/2022, 6:42 PM
    what next? Reactlets?
  • g

    gorgeous-airport-54386

    11/03/2022, 8:11 PM
    It's a pun on React Server Components I think
  • h

    hallowed-oyster-8093

    11/04/2022, 7:54 AM
    Not used Discord before, excuse if in wrong channel or what-not. What's the htmx wisdom on web components? If I have to have JS enabled for htmx, then web components seem to be a good idea (encapsulating client only markup and behaviour). I wrote my first web component yesterday with a few attributes. Then placed multiple onto a page for different blood markers (vitamin D, vitamin B12, etc, many different). It makes the page short, sweet and semantic with no copy/paste errors from inlining. The page is static for now, but what's view here htmx + web components. Seeking wisdom. Has grug talked about this? 😳
  • b

    brainy-ice-92385

    11/04/2022, 8:03 AM
    You can search thru Discord in the top right, there's been lots of chatter about it. The key issue with web components and htmx is that it's hard to fully render the component on the server and send it to the client, especially when there is a shadow DOM. So SSR + WebComponents = ???. WebC by 11ty has a solution: https://www.11ty.dev/docs/languages/webc/ LitElement also has a solution. If you just want to send
    <blood-marker></blood-marker>
    in a server response, and let the client render it via JavaScript as normal, then there's no conflict at all.
  • h

    hallowed-oyster-8093

    11/04/2022, 8:29 AM
    I'm not so worried about server rendering the WC's shadow DOM, I'm happy to deliver the full WC to the client. In the particular case of it's all client side calculations, no htmx, no ajax. I will be hosting the page on my rPI so I'm being cheap and don't want a server at all (just nginx)! WC are so obvious to tidy up the page and avoid duplication. If htmx or something like it were ever standardised into html itself (as it should be) then I'd have to reconsider using dynamic WC; one of my beefs is having to use JS at all. JS would be optional sugar on top. I really dislike websites that are blank or non-functional without JS. I think I'm going to rewrite my WC in LitElement. Thanks for your response, it's good to know there's no conflict between WC and htmx in the normal case.
  • r

    red-dinner-66239

    11/04/2022, 9:02 AM
    Hey i have a question, htmx he is working with vue.js ? because i have a loop with vue.js (v-for) and in my loop i have hx-post, but he doesn't work
  • r

    ripe-action-67367

    11/04/2022, 9:24 AM
    htmx must be initialized on new DOM nodes by calling htmx.processNode()
  • r

    ripe-action-67367

    11/04/2022, 9:24 AM
    that said, using htmx in vue components is a finicky setup
1...889890891...1146Latest