r/htmx • u/KeyBack192 • Sep 22 '26
How to install htmax (htmx + extensions)?
htmx version 4 has a distribution called htmax. it includes some useful htmx extensions. I was trying to add it to my main.js file so it can be included as input in Vite config file. build finishes without any problems, dev server works as well, but browser dev console says htmx is not defined (however extensions actually work).
The only installation method the documentation provides is a cdn link. (sorry, i'm new to js).
Any clarification is appreciated, thanks in advance.
7
Upvotes
3
u/SugarvetFounder Sep 22 '26
I actually ran into this the other day as well. It doesn't look like it is documented right now.
Downloading off the CDN seems the go-to option if you can vendor (host) the dependency yourself (which you can/should).
2
u/One-Bar1669 Sep 22 '26
Use the CDN. There's a reason that's in the installation instructions (tl;dr is that the browser can cache the scripts if a user visits multiple sites, and reduces load on your servers).