HTMX and Astro Are An Amazing Combo!

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ธ.ค. 2024

ความคิดเห็น •

  • @ashimov1970
    @ashimov1970 7 หลายเดือนก่อน +6

    Jack Herrington has a 9 mins long video on HTMX + Astro where he shows how to npm install and configure htmx in Astro

  • @graham8316
    @graham8316 7 หลายเดือนก่อน +6

    when people are saying back in the day I think they're talking about before 10 yrs ago.

  • @coffeeintocode
    @coffeeintocode 8 หลายเดือนก่อน +7

    I find it better to serve the JS file for HTMX myself from my server. But CDN is the way most people prefer to do it

    • @jjaimealeman
      @jjaimealeman 8 หลายเดือนก่อน +3

      The purpose of the CDN is so that subsequent visitors have HTMX cached, so it loads faster.
      What benefit is there to self-hosting? 🤔

    • @schurlixx
      @schurlixx 8 หลายเดือนก่อน

      htmx.min.js.gz is 15675 bytes btw.

    • @steven11101010
      @steven11101010 8 หลายเดือนก่อน +2

      @@jjaimealeman That's not entirely true. Subsequent visitors have nothing to gain from what another visitor did. At most, only visitors from the same POP may get a cached version from that CDN POP. But that's not all visitors, nor is it guaranteed. With self hosting you have an unaltered version of the library. External hosting allows for hijacking of that dependency. It's also an external dependency, so if that server or DNS has issues, you now have issues. Lastly, HTTP2 can actually serve the serve the file faster since your browser has already established a TCP connection to your site.

    • @JamesLuterek
      @JamesLuterek 5 หลายเดือนก่อน

      Having a shared CDN gained popularity in the early 2000's. While there many libraries, JQuery was gaining dominance. The idea is that if MOST websites loaded JQuery, it would be more efficient to have a CDN referenced on every website. This way the browser could cache the file and re-use it across websites saving on bandwidth and hard disk space.

    • @owenwexler7214
      @owenwexler7214 5 หลายเดือนก่อน +1

      Self-hosting > CDN if there’s a way to do it with Astro. Don’t know much about Astro yet but I can imagine it has a /public or /static folder that can serve static content yes?
      The CDN being down the same day as a viral article about one of my sites is the kind of scenario that compels me to self host anything I can as a matter of course.

  • @jjaimealeman
    @jjaimealeman 8 หลายเดือนก่อน +1

    I GOTTA check this out 🎉

  • @owenwexler7214
    @owenwexler7214 5 หลายเดือนก่อน

    The AH Stack?

  • @abrotherinchrist
    @abrotherinchrist 2 หลายเดือนก่อน

    With Islands isn't it now pointless to use HTMX with Astro?

    • @savroff
      @savroff หลายเดือนก่อน

      I would not say so. HTMX provides a lot of sugar on top. But Islands are awesome 💙

  • @funfact-2024
    @funfact-2024 7 หลายเดือนก่อน

    thanks James, can you tell me about security to avoid other websites using your api on htmx and Astro?

    • @winmonaye
      @winmonaye 4 หลายเดือนก่อน

      I think usually just need to set up the CORS.

  • @jirgrami5787
    @jirgrami5787 3 หลายเดือนก่อน

    It seems very useful but why .astro tho? what if the user goes to that file path instead, isnt that just a public route? how can i protect that "endpoint"

  • @zebapy
    @zebapy 6 หลายเดือนก่อน +1

    What are the real prod use cases for HTMX? Seems like sprinkling into existing traditional server rendered sites / apps. Building a whole app with it seems awkward.

    • @benbowers3613
      @benbowers3613 4 หลายเดือนก่อน +1

      I'd say that with htmx AND alpinejs, the majority of frontend reactivity requirements can be met. The bundle size of htmx and alpinejs combined is still less than react-dom by about 20 MB. That said, I think there's really only one main reason not to use the serverless options: *backend savings*. Especially if you get up to 5 or 6 active projects, serverless costs can really get up there. It really just comes down to that for the more cost effective backend (using an actually fast, compiled language), htmx is generally more suited than the modern frameworks. The modern frameworks have kind of backed themselves in a corner where they really only work well/conveniently in a serverless environment.
      TL;DR: Use the modern frameworks for projects you need to scale effortlessly, but have a cheaper backup stack for smaller projects so you can host many of them without incurring too much costs.

  • @ontheruntonowhere
    @ontheruntonowhere 7 หลายเดือนก่อน

    Last 🥲

  • @Paxters_
    @Paxters_ 8 หลายเดือนก่อน +1

    First🎉