https://htmx.org logo
Join Discord
Powered by
# šŸ”„-django-htmx
  • m

    mammoth-family-48524

    12/08/2022, 10:40 PM
    How do you do your cache busting? I have a few js files that I’d like to do cache busting for but only when they change.
  • m

    mammoth-family-48524

    12/08/2022, 10:53 PM
    I’m just manually adding a date as a query string parameter to the script links at the moment šŸ˜†šŸ¤·ā€ā™‚ļø
  • m

    mysterious-toddler-20573

    12/09/2022, 12:32 AM
    I'd like to see a combo where you use a dependency manager, but dependencies are checked in as well I feel like that's the next step
  • g

    green-activity-6102

    12/09/2022, 1:22 AM
    lol i do the same -- I append
    ?v=2
    to the end of my paths, and just increment the number when i make changes to the static file
  • r

    refined-waiter-90422

    12/09/2022, 6:16 AM
    That's how you cache-bust without over-engineering a solution, yeah.
  • r

    refined-waiter-90422

    12/09/2022, 6:30 AM
    when
    npm
    becomes part of your project
  • m

    mammoth-family-48524

    12/09/2022, 6:44 AM
    Haha, that's a much better quality one
  • m

    mammoth-family-48524

    12/09/2022, 6:45 AM
    This popped up in my mailbox just now 😱 https://stackoverflow.com/questions/71569814/how-can-i-bundle-up-an-npm-package-so-i-can-import-objects-from-it-in-a-script
  • m

    mammoth-family-48524

    12/09/2022, 6:47 AM
    I wanted to use Tip Tap with Django a while ago and I couldn't find a straightforward way to just get it as a file I could include. The StackOverflow Q/A was the solution I came up with
  • g

    green-activity-6102

    12/09/2022, 4:39 PM
    FYI -- https://github.com/hugohomesquita/htmx-jetbrains
  • r

    refined-waiter-90422

    12/09/2022, 9:31 PM
    some new web framework on HN
  • r

    refined-waiter-90422

    12/09/2022, 9:32 PM
    ā˜ļø top reply lol
  • w

    white-motorcycle-95262

    12/10/2022, 3:07 PM
    I recently came across this https://htmx.org/docs/#caching based on a Twitter thread. Does anyone know if adding
    Vary: HX-Request
    headers is something that would fit in the scope of the
    django-htmx
    package (specifically the Middleware)? @high-toothbrush-44006
  • m

    melodic-advantage-28381

    12/14/2022, 8:51 AM
    Related discussion here: https://discord.com/channels/725789699527933952/1050498902396252232
  • m

    melodic-advantage-28381

    12/14/2022, 9:19 AM
    npm has nothing to do with bundling/minifying. It's a dependency manager. JS dependencies need to be managed, exactly as Python dependencies. What if a security issue gets discovered on htmx? Don't you want Dependabot to warn you about it, and to open a PR as soon as a new releases fixes the issue? As for bundling/minifying, let's use the right tool for the job: esbuild is crazy fast and allows writing modern JS (especially ES6 imports).
  • m

    melodic-advantage-28381

    12/14/2022, 9:24 AM
    Sorry I don't understand what you mean here šŸ˜•
  • b

    boundless-vase-80440

    12/14/2022, 11:24 AM
    Adding node_modules to git is highly discouraged. Therefore, it is worth to try.
  • h

    hundreds-camera-24900

    12/15/2022, 2:37 AM
    I think yarn 2 adds to git with it's pnp stuff
  • m

    melodic-advantage-28381

    12/15/2022, 9:20 AM
    I can't really tell if you guys are serious or not, so let me explain our setup at Contexte : - JS dependencies are listed in a
    package.json
    with only major version specified (
    "htmx.org": "1.*"
    ) - The
    package-lock.json
    is generated after npm install and is versioned in Git alongside with
    package.json
    - Our web pages all load a
    main.js
    file that is an ES6 file where we put
    import "htmx.org"
    (among other things, like what we need to use SimulusJS) ; these
    main.js
    files do not live in the standard
    static
    Django folder but in a separate
    static_src
    folder - We use esbuild to transpile this ES6 and bundle everything needed into one
    main.js
    file per page, which live in the standard
    static
    folder (which makes them usable by
    collectstatic
    , the
    {% static %}
    templatetag, and Django cache-busting capabilities) - Obviously
    node_modules
    folder is Git-ignored, as well as every Django app
    static
    folder (CSS also live in
    static_src
    as they also are compiled/bundled using postcss) With all this, we get : - Properly managed JS dependencies, that can be parsed and updated by Github's Dependabot - The ability to write modern JS for our apps (ES6 imports, not caring about JS files loading order, etc.) @mysterious-toddler-20573 does that answer your question ?
  • r

    refined-waiter-90422

    12/15/2022, 12:37 PM
    A killer feature of htmx is that it does not dictate your projects language, architecture, or tooling. It can be used with any dep/build system you want, by default- you can even run it directly from a local
    index.html
    file, by default, easy. If a dev wants to use it with npm, they can (or any other dep/build system of the month next time the node community re-invents itself) .. and if some new dep/build system is used, they can use that too without second-guessing the docs or assuming its npm-only.
  • b

    boundless-vase-80440

    12/15/2022, 12:46 PM
    I use it with pug, so technically I don't even use HTML...
  • v

    victorious-thailand-80225

    12/15/2022, 2:27 PM
    Yes. It's almost as if getting rid of js allows you to write front end code in any other language. So weird.
  • m

    mysterious-toddler-20573

    12/15/2022, 3:42 PM
    šŸ™‚ yes, that makes tons of sense, I was being a bit speculative in my language
  • h

    hundreds-camera-24900

    12/16/2022, 4:46 AM
    I do something similar but with django-vite
  • h

    hundreds-camera-24900

    12/16/2022, 4:47 AM
    Because vite can do glob imports I have something approaching angular's folder per component with template css and js all colocated
  • h

    hundreds-camera-24900

    12/16/2022, 4:47 AM
    Still trying to figure out how to do SFC
  • r

    ripe-ghost-5606

    12/17/2022, 4:16 PM
    Does anyone have a live example of a Django/HTMX site that's doing something more than generic blog type stuff? Especially if it uses react/Vue for some part where it makes sense
  • r

    ripe-ghost-5606

    12/17/2022, 4:16 PM
    (Doesn't need to be open source)
  • e

    early-camera-41285

    12/17/2022, 7:05 PM
    I'm 90% done building a website for viewing very hi res images for the research institute I work at (studying ancient manuscripts is actually my day job). It is mostly HTMX but also creates and consumes a IIIF image API, and the image viewer is a React component. It isn't live today, but the alpha version will be up soon, maybe a week.
  • r

    ripe-ghost-5606

    12/17/2022, 7:06 PM
    I'd love to see it when it's done, that sounds like the exact kind of thing I'm looking to see. Largely unrelated, but I once jammed a IIIF image viewer (Universal Viewer) into a ReactJS app and it was a giant PITA
1...868788...100Latest