_chrismay,
@_chrismay@fosstodon.org avatar

The conversations at DjangoCon US have convinced me that there's a thirst for knowledge about in the community.

What questions do you have?

I'd love to help answer them!

anze3db,
@anze3db@fosstodon.org avatar

@_chrismay how to improve the dev experience that you get by adding htmx to a Django project? Install django-htmx, and some sort of a partials renderer like django-template-partials, anything else?. How to improve DX when your htmx views error out?

christophb,

@_chrismay I often encountered the problem of additional JS not working properly. For example in forms with tinyMCE, or even when I used some custom hyperscript that‘s loaded with the form. The browser tries to execute the code referenced in the loaded HTML partial before the external ressource is loaded and parsed. Mostly happens on first load (afterwards, the JS file is cached), but also when returning to a form after validation error. Simple problem, but I couldn‘t reliably fix it. 🤔

_chrismay,
@_chrismay@fosstodon.org avatar

@christophb I'd be curious to see how this code is implemented.

As you describe it, JS is executing before frameworks are loaded.

Without knowing more about it, it sounds like the custom code needs to be wrapped in some document- or framework-ready event.

christophb,

@_chrismay I‘ll put something together. I have a few simple examples in mind. 👍 Maybe I‘ll even be able to produce a (hacky) solution for the examples - your hypothesis is most probably correct.

webology,
@webology@mastodon.social avatar

@_chrismay aka "I couldn't get Jeff to shut up about..."

I think all content would be welcome. I think we are missing basic to intermediate content for how to use htmx with:

  • forms
  • search
  • autocomplete
_chrismay,
@_chrismay@fosstodon.org avatar

@webology THANKS!!!

I don't understand your reference about not shutting up… I feel as though we hardly had any time to talk at DCUS.

webology,
@webology@mastodon.social avatar

@_chrismay I meant in the spirit of topics I'm always happy to discuss and not shut up about. 😄

Let's make more excuses to chat. Happy to video some time.

_chrismay,
@_chrismay@fosstodon.org avatar

@webology YAS!

webology,
@webology@mastodon.social avatar

@_chrismay we are missing a good intro that walks through the quick wins aka the AJAX hx-(get|post|delete|*) with some example Django view code would be helpful to point people to.

Then hx-trigger + hx-swap + hx-target basics would have helped me with a practical example.

cathodion,

@_chrismay what are some interesting things people have built with it, and how did it go?

cathodion,

@_chrismay
also, what’s inheriting #htmx legacy code like?

_chrismay,
@_chrismay@fosstodon.org avatar

@cathodion Thanks for the questions!

I'm going to research more answers, but to start with, I was impressed with the react to htmx conversion of Contexte's web app: https://www.youtube.com/watch?v=3GObi93tjZI&t=1187s

shacker,
@shacker@zirk.us avatar

@_chrismay I want to understand it’s limits. I assume there are still some things we need react or Vue for. But what are those things? Or is my assumption wrong?

pythonbynight,
@pythonbynight@fosstodon.org avatar

@shacker @_chrismay I found this article by Carson Gross (creator of htmx) to be extremely helpful for "when to use htmx" and when not to...

https://htmx.org/essays/when-to-use-hypermedia/

tldr for when not to:

  • Lots of interdependencies (i.e., one action that affects multiple elements in the DOM at once)
  • offline functionality (because htmx depends on server events)
  • continuous updates (stuff like games/drag and drop/etc...)
pythonbynight,
@pythonbynight@fosstodon.org avatar

@shacker @_chrismay And of course, important to remember that it doesn't have to be an either/or scenario. The idea is recognizing what htmx is good for and leaning into that.

shacker,
@shacker@zirk.us avatar

@pythonbynight @_chrismay Thanks for the input, and for the link. Very good read. TLDR; for me was 1) Not great when you need to update the DOM in multiple places at once; 2) Not great when you need to control totally different parts of the page. That really helps bring things into focus, thanks.

_chrismay,
@_chrismay@fosstodon.org avatar

@shacker I'm with you! I'm working to find its limits, too.

Htmx's primary focus is elegant server communication.

AlpineJS (or hyperscript) are complimentary frameworks that focus on rich in-page experience.

The hardest I've pushed the stack is by building a rules engine with htmx, AlpineJS, and Django. It works beautifully…

#htmx #python #alpinejs

_chrismay,
@_chrismay@fosstodon.org avatar

@shacker That said, I had my doubts about how complicated the code is for that tool. In the heat of deadlines, it's hard to have clear vision.

I talked with another developer about handing the in-page complexity to a front-end JS framework.

Since that discussion, I realized I should have used Contexte's strategy of raising JS events when updating the page. That would have simplified a lot of the code.

source: https://youtu.be/3GObi93tjZI?t=529

shacker,
@shacker@zirk.us avatar

@_chrismay Thanks for the input, and for the link. Very good read. TLDR; for me was 1) Not great when you need to update the DOM in multiple places at once; 2) Not great when you need to control totally different parts of the page. That really helps bring things into focus, thanks.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • DreamBathrooms
  • ngwrru68w68
  • tester
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • tacticalgear
  • megavids
  • osvaldo12
  • normalnudes
  • cubers
  • cisconetworking
  • everett
  • GTA5RPClips
  • ethstaker
  • Leos
  • provamag3
  • anitta
  • modclub
  • JUstTest
  • lostlight
  • All magazines