https://htmx.org logo
Join Discord
Powered by
# ruby-htmx
  • r

    refined-waiter-90422

    01/29/2023, 10:53 PM
    Slick
  • m

    mysterious-toddler-20573

    01/29/2023, 11:57 PM
    very cool, are you going to post this online somewhere?
  • a

    adventurous-ocean-93733

    01/30/2023, 12:33 PM
    Looks great. Is this in your
    hemo
    git repo?
  • b

    busy-action-85810

    01/30/2023, 2:10 PM
    **Carson/Elliot**: Yeah, I posted the above here: - Hanamismith (https://www.alchemists.io/projects/hanamismith) - Scroll down to the demonstration section. - Mastodon: https://mastodon.social/@bkuhlmann/109774878643349616 **Elliot**: Yeah, the code for this is in the Hemo repository: https://github.com/bkuhlmann/hemo I need to do some more work on this before doing more broadcasting but enjoying the progress so far! ๐Ÿš€
  • a

    adventurous-ocean-93733

    01/31/2023, 5:12 PM
    Interested to hear about the experience of anyone using rails + htmx + _hyperscript I wondered if thereโ€™s some friction with htmx and turbo, Hotwire etc since I expect these are the default and built in. Also, Iโ€™m trying to avoid too much magic and last time I used rails I found it quite frustrating because it wasnโ€™t clear what was actually happening behind the scenes.
  • r

    refined-waiter-90422

    01/31/2023, 5:22 PM
    yeah I find htmx is more akin to a set of atomic building blocks that extend html. Turbo is more of a black box- if it works, amazing, but if you need anything beyond the defaults, its a lot less flexible before you'll need to change the source code.
  • r

    refined-waiter-90422

    01/31/2023, 5:22 PM
    Also the turbo source code is really freakin complex with a lot of moving parts vs 1 js file htmx.
  • a

    adventurous-ocean-93733

    01/31/2023, 5:40 PM
    @refined-waiter-90422 yeah htmx really appeals to me for these reasons. Have you used htmx and rails?
  • m

    mysterious-toddler-20573

    01/31/2023, 5:48 PM
    i used intercooler.js/htmx w/ rails for a long time and disabled turbolinks (this was pre-turbo) so they wouldn't interfere w/ one another. I know some folks have wired in
    htmx.process()
    to turbolinks to make htmx work for smaller-target updates while keeping turbolinks for normal navigation in rails.
  • b

    busy-action-85810

    02/01/2023, 12:29 AM
    **Elliot**: Yeah, I've been avoiding React, Hotwire, etc. for years. Been using Elm (https://elm-lang.org) -- which is amazing -- until I discovered HTMX. ...but, ultimately, I really don't want a lot of JavaScript in my Ruby web apps. Having consulted and worked with larger companies where teams of JavaScript engineers stumble all over each other while also seeing GBs of shoveled into the
    node_modules
    folder is enough to make an engineer go crazy. ๐Ÿ˜… ...but to answer your question directly, the problem is that by default Rails is wired with Hotwire....and so many people just cargo cult that. **Gnat**: Yeah, another reason why I don't want to deal with Hotwire/Turbo/Stimulus. **Carson**: Yeah, I'm trying to make a hard push for Hanami + HTMX and hope to demo this more soon.
  • b

    busy-action-85810

    02/01/2023, 12:30 AM
    Exciting! Seb Wilgosz featured Hanamismith/HTMX (plus me ๐Ÿ˜… ) in the latest episode of Hanami Mastery: https://hanamimastery.com/episodes/40-hanamismith
  • g

    gorgeous-activity-10760

    03/16/2023, 11:07 AM
    Is there some sort of template fragment support for ERB, Haml or other template engines?
  • e

    echoing-dress-67727

    03/21/2023, 6:29 PM
    @gorgeous-activity-10760 Not sure what you mean. I usually just
    render partial: "..."
    in my controllers
  • e

    echoing-dress-67727

    03/21/2023, 6:29 PM
    I've also created:
    Copy code
    def htmx_request?
        request.headers["HX-Request"]
      end
      helper_method :htmx_request?
    and I sometimes use it in the controller to render a partial instead of the full view
  • e

    echoing-dress-67727

    03/21/2023, 6:33 PM
    I also considered defining a customer responder, but I think I would need to change the extension or mime type for that
  • g

    gorgeous-activity-10760

    03/25/2023, 2:35 PM
    I mean like described in this article: https://htmx.org/essays/template-fragments/ If there's support for it in Ruby it would be nice to add that to the list of HTMX 'Known Template Fragment Implementations' AFAIK partials are strictly a Rails concept, but I will check it out.
  • I use the Phlex rendering library to get those results.
    o

    orange-nail-40296

    04/06/2023, 10:54 PM
    I use the Phlex rendering library to get those results.
  • i

    important-machine-88038

    05/04/2023, 3:55 PM
    Hey! I'm about to start a new Ruby on Rails project and plan to go all-in on HTMX. Got any advice?
  • i

    important-machine-88038

    05/04/2023, 3:56 PM
    Someone on Twitter mentioned they completely disabled the asset pipeline... that seems extreme but maybe it's a good idea?
  • g

    great-cartoon-12331

    05/04/2023, 4:03 PM
    i'm not using RoR but, i personally don't have an asset pipeline on my app either. just a cached
    static/
    directory
  • i

    important-machine-88038

    05/04/2023, 9:11 PM
    Good to know... the Twitter conversation seems to have turned against CSS/JS minification or transpilation altogether, even just in the name of being able to read a stack trace... so I think the case has been made.
  • i

    important-machine-88038

    05/04/2023, 9:11 PM
    What are you using? Sinatra?
  • g

    great-cartoon-12331

    05/04/2023, 10:55 PM
    OCaml. although i should correct my earlier statement. technically, i do have an asset pipeline, it's just to output a Tailwind CSS file. it's just one step so i totally forgot about it. no rev-hashing, nothing sophisticated at all.
  • g

    great-cartoon-12331

    05/04/2023, 10:56 PM
    command in my Dockerfile:
    ./tailwindcss-linux-x64 -i ./static/input.css -o ./static/output.css --minify && rm static/input.css
  • b

    busy-action-85810

    05/05/2023, 1:57 PM
    I'm not using an asset pipeline either. Everything is built upon Hanami + HTMX. If you need a quick start for experimentation, check out these projects: - https://alchemists.io/projects/hanamismith - For quickly building a skeleton Hanami project. - https://github.com/bkuhlmann/hemo - A demo project built with Hanamismith using HTMX.
  • i

    important-machine-88038

    05/05/2023, 5:12 PM
    For the sake of trying to limit the number of new things I'm learning at once, I created a new Rails project using propshaft (instead of sprockets), since the asset fingerprinting seems worth keeping. I'm going with Bootstrap for similar reasons; a little nervous about that but it seems like a few other people are doing Bootstrap+HTMX without incident.
  • o

    orange-nail-40296

    05/09/2023, 7:51 PM
    Going with the default rails with prop shaft or even import maps will be fine. I use stimulus with htmx and I find it to be complementary.
  • i

    important-machine-88038

    05/12/2023, 1:10 PM
    I started a new Rails project with propshaft and I got this `app/javascript/application.js`:
    Copy code
    // Entry point for the build script in your package.json
    import * as bootstrap from "bootstrap"
    I added htmx and hyperscript via yarn and then added these lines:
    Copy code
    import * as _hyperscript from "hyperscript.org/dist/_hyperscript"
    import * as htmx from "htmx.org/dist/htmx"
    After I do this, HTMX works, but Hyperscript does not! After a ton of trial and error, I finally got it working by adding this line:
    Copy code
    _hyperscript.browserInit();
    So, hooray, it works, but also I didn't come across this in any of the docs or anywhere else. And now I'm not sure if I'm setting it up correctly. How come HTMX can initialize itself but Hyperscript cannot? Is this a bug? I don't know enough about JavaScriptWorld to understand what is happening here (but I'd like to!)
  • b

    busy-action-85810

    05/20/2023, 9:51 PM
    ๐Ÿ“ฃ Hey folks, I released the HTMX gem today to help augment and support the HTMX JavaScript library. You can find it here: https://alchemists.io/projects/htmx. Granted, early days with this gem -- I know -- but I'm planning to add more support for working with HTMX within Ruby in the future. If you have suggestions, questions, etc. let me know or open an issue. Enjoy! ๐Ÿ™‡
  • o

    orange-nail-40296

    05/23/2023, 2:53 AM
    Awesome gem!