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

    mysterious-toddler-20573

    03/15/2023, 8:27 PM
    mmm
  • o

    orange-umbrella-16693

    03/15/2023, 11:14 PM
    What was the name of the technique for extracting parts of a template from a single HTML template file? Document fragments?
  • m

    mysterious-toddler-20573

    03/16/2023, 12:35 AM
    template fragments? https://htmx.org/essays/template-fragments/
  • o

    orange-umbrella-16693

    03/16/2023, 12:35 AM
    Oh yes that! Thank you!
  • a

    agreeable-midnight-69265

    03/16/2023, 1:06 AM
  • m

    mysterious-toddler-20573

    03/16/2023, 1:12 AM
    PR?
  • m

    mysterious-toddler-20573

    03/16/2023, 1:13 AM
    how do folks feel about this feature?
    Copy code
    html
    <button hx-post="/whatever"
            hx-on-config-request="event.detail.parameters['foo'] = 'bar'">
      Send Request
    </button>
  • m

    mysterious-toddler-20573

    03/16/2023, 1:14 AM
    basically
    hx-on
    attributes for all the htmx events
  • l

    late-king-98305

    03/16/2023, 2:17 AM
    Give support library authors a few days' warning to prepare our releases... πŸ™‚ That's a lotta new attributes!
  • m

    mysterious-toddler-20573

    03/16/2023, 2:17 AM
    rather so
  • m

    mysterious-toddler-20573

    03/16/2023, 2:17 AM
    I'm not sure this is even a good idea or not
  • m

    mysterious-toddler-20573

    03/16/2023, 2:18 AM
    does it step on alpine/hyperscript too much? or is it a good 80/20 that would allow folks to not have to bring in another dependency?
  • l

    late-king-98305

    03/16/2023, 2:24 AM
    I'm probably not a good person to answer that; at most, I've found a few plain JS functions handled what I needed them to do in my UIs. My apps tend to be boring use a minimal design.
  • m

    miniature-window-68019

    03/16/2023, 2:49 AM
    I like it because it feels pretty consistent with standard html attributes
  • r

    refined-waiter-90422

    03/16/2023, 5:11 AM
    Wasn't sure if this was the original proposal, 1cg, but... Imagine using
    hx-on-*
    to capture ANY event, not just htmx ones πŸ‘€ htmx could universally handle
    hx-on-yourevent
    , the side effect being all htmx events too. Would keep the implementation and extra documentation to a minimum as well.
  • r

    refined-waiter-90422

    03/16/2023, 5:24 AM
    basically classic html
    on*="..."
    but extended to handle whatever event you want.
  • r

    refined-waiter-90422

    03/16/2023, 5:28 AM
    Contrived case, but these would be equivalent:
    hx-on-click="..."
    πŸ”
    onclick="..."
  • r

    refined-waiter-90422

    03/16/2023, 5:34 AM
    the only reason I don't use
    onclick="..."
    etc. more often is because custom events are not supported, otherwise they are super convenient (supports async, too!). It'd be very on brand for htmx being an extension of html.
  • r

    refined-waiter-90422

    03/16/2023, 5:44 AM
    sounds like a feature someone may want to use htmx for all by itself πŸ‘Œ
  • r

    ripe-action-67367

    03/16/2023, 6:31 AM
    I generally agree, that there is a use case for that, but I'm not so sure about the syntax. Specifically, having a separate attribute for each event looks like bloat. I agree with gnat here, htmx should support handling any event, but I'm not sure if current syntax allows to do this efficiently. On the other hand, I didn't try it, so maybe I'm overestimating how slow such implementation could actually be
  • r

    refined-waiter-90422

    03/16/2023, 6:34 AM
    For implementation, i'm simply thinking: if
    <div hx-on-yourevent="..." />
    exists, setup event listener for
    yourevent
    on that element using
    "..."
    . No need to pre-setup every possible event.
  • e

    echoing-lion-55988

    03/16/2023, 7:07 AM
    Isn’t it basically x-on from alpine.js?
  • v

    victorious-minister-78060

    03/16/2023, 8:10 AM
    imo this is exactly what hyperscript is for
  • r

    refined-waiter-90422

    03/16/2023, 9:17 AM
    Yup- the bang for buck is high. An attribute that could remove client side libraries for many projects, by extending a concept already in HTML.
  • c

    clever-activity-24633

    03/16/2023, 10:01 AM
    I'm looking for a type-safe template cross-platform engine to represent htmx views. While Mustache and Handlebars are cross-platform they provide limited type safety (static analysis when consuming the template and providing the context). On the other-hand, there are many type-safe template engines such as Swirl and Rocker which are type-safe but not cross-platform (we want different platforms to consume those templates).
  • gomponents, view components in pure Go
    e

    echoing-lion-55988

    03/16/2023, 10:13 AM
    https://www.gomponents.com/
    c
    • 2
    • 7
  • e

    echoing-lion-55988

    03/16/2023, 10:14 AM
    What you’re looking is something jsx-like
  • Type safe HTML sounds a little funny to
    e

    echoing-lion-55988

    03/16/2023, 10:14 AM
    Type safe HTML sounds a little funny to me, because web spec did everything they could to make HTML works even if it’s broken πŸ˜€
    c
    • 2
    • 2
  • e

    echoing-lion-55988

    03/16/2023, 10:15 AM
    Anyway if you really want to be on the safe side, use some backend library to generate HTML from ast like gomponents.
  • e

    echoing-lion-55988

    03/16/2023, 10:17 AM
    You can then leverage your language of choice type system to build type safe components.
1...106910701071...1146Latest