https://htmx.org logo
Join Discord
Powered by
# πŸ”₯-django-htmx
  • h

    hundreds-camera-24900

    10/13/2022, 9:31 PM
    there's both a limit to the number of http requests that the browser will do at once + an overhead to each http request
  • h

    hundreds-camera-24900

    10/13/2022, 9:31 PM
    so by putting it in one you theoretically shave some time off to first paint
  • h

    hundreds-camera-24900

    10/13/2022, 9:32 PM
    but it's real dependent on the number of assets you're including per page - if you have 2 js files and one css you're not going to save that much time by concatenating the js files together
  • w

    white-motorcycle-95262

    10/13/2022, 9:38 PM
    Gotcha, thanks for explaining that to me!
  • h

    hundreds-camera-24900

    10/13/2022, 9:39 PM
    I've seen some apps that have 15+ files and in those cases you would get a great boon by combining
  • h

    hundreds-camera-24900

    10/13/2022, 9:40 PM
    the limit I think is 6 requests btw so as long you stay under that I don't think you save any time
  • h

    hundreds-camera-24900

    10/13/2022, 9:40 PM
    actually might save time to do them simultaneously
  • w

    white-motorcycle-95262

    10/13/2022, 9:45 PM
    Weird, what does ~6 come from?
  • h

    hundreds-camera-24900

    10/13/2022, 9:45 PM
    https://stackoverflow.com/questions/52220159/how-many-maximum-number-of-simultaneous-chrome-connections-threads-i-can-start-t
  • h

    hundreds-camera-24900

    10/13/2022, 9:45 PM
    no idea if it's changed
  • h

    hundreds-camera-24900

    10/13/2022, 9:46 PM
    πŸ™‚
  • w

    white-motorcycle-95262

    10/13/2022, 9:52 PM
    Good to know, though. Thanks πŸ™‚
  • b

    bitter-monkey-50309

    10/13/2022, 10:17 PM
    It's worth pointing out that's for HTTP1.1. With HTTP2 only 1 connection will be opened per host, but due to multiplexing it can basically do an unlimited number of concurrent requests, with the spec recommending browsers support at least 100.
  • b

    bitter-monkey-50309

    10/13/2022, 10:23 PM
    To answer your question, I don't bother any more with only a dozen or so files. If you've got loads you might want to experiment with something like webpack that can also do tree shaking to remove dead code and bundle splitting so it's not bundled into 1 huge file. I've never set that up though, it's always been done by more frontend-y devs, my grug brain just slaps some script tags in and calls it a day
  • h

    hundreds-camera-24900

    10/13/2022, 10:23 PM
    I use django-vite and I don't have to think about it
  • b

    bitter-monkey-50309

    10/13/2022, 10:26 PM
    Ooh not heard of that, will have to check it out
  • h

    hundreds-camera-24900

    10/13/2022, 10:26 PM
    it's less hassle than webpack
  • h

    hundreds-camera-24900

    10/13/2022, 10:26 PM
    still have to run an npm command though
  • w

    white-motorcycle-95262

    10/13/2022, 11:11 PM
    Yeah, I dunno if I quality for "loads," just having bootstrap, HTMX, Hyperscript, TomSelect and a few others (Vivus for SVG animation, html2canvas, and a small file of my own). Thanks both of ya for the input.
  • b

    boundless-advantage-43563

    10/14/2022, 11:18 PM
    Hi, i'm looking for a talk in Djangoconf Eur about reducing the codebase by a 67% from React to HTMX, is the talk already uploaded in the youtube channel? I didn't manage to find it :(, could it be a day 3 talk?

    https://www.youtube.com/watch?v=0kOLsFQGxyk&list=PLY_che_OEsX3eIKKLUKvQXfVJhCHYWATMβ–Ύ

  • m

    mysterious-toddler-20573

    10/14/2022, 11:29 PM
    Looks like they are still being added I can’t wait to see it either!
  • b

    boundless-advantage-43563

    10/15/2022, 3:16 PM
    enjoy it my man!

    https://www.youtube.com/watch?v=3GObi93tjZIβ–Ύ

  • m

    mysterious-toddler-20573

    10/15/2022, 3:31 PM
    LETS ABSOFUCKINGLUTELY GOOOOOOOOO
  • b

    blue-gold-89534

    10/16/2022, 9:25 PM
    How would I serve a file with
    hx-get
    ?
    Copy code
    python
    def startDownload(request, pk = None):
        file_path = "... path to file ..."
        return FileResponse(open(file_path, "rb"), as_attachment = True)
    and in the template:
    Copy code
    html
      <img src="{% static 'images/printer.svg' %}"
           hx-get="{% url 'download' model.pk %}"
           hx-trigger="click">
    I can see the png I am trying to load in the webdev console response, but no save dialogue is showing. Is
    hx-get
    the right choice?
  • g

    gorgeous-airport-54386

    10/16/2022, 9:26 PM
    Why not use a normal
    <a download href="...">
    ?
  • b

    blue-gold-89534

    10/16/2022, 9:27 PM
    that was just too simple 😦
  • g

    gorgeous-airport-54386

    10/16/2022, 9:28 PM
    bonks you with club
  • b

    blue-gold-89534

    10/16/2022, 9:28 PM
    i deserve that.
  • m

    mysterious-toddler-20573

    10/17/2022, 12:07 AM
    \> we don't have this on the htmx homepage \> zed shaw hates us because of this one thing
  • b

    breezy-minister-64652

    10/18/2022, 10:26 AM
    Hi, I'm new to htmx - and coding in general, - and find myself having some difficulties understanding how the syntax works with events. I'm currently working on allowing users to edit their page on my app, and I'd like to have an "edit saved" appear briefly each time a field has been edited. I thought of using "htmx:afterRequest" [https://htmx.org/events/#htmx:afterRequest] to show that the edit has been saved when the response has a 20x status code, or else that there was an error. But I cannot work my head around how to approach the syntax of that So, my question: How would you use "htmx:afterRequest" if you would like to add a message to a div #requestresult if detail.succesful=true or detail.failed=true ?
1...767778...100Latest