Npm module for extensions
Hi there, I installed htmx via npm module. I want to also use some extensions. But mix htmx from npm and extensions in script tag doesn't work. Are there npm module equivalent for extensions ? Or any workaround to use extensions with htmx in .js files ?
Sincerely
Can you post the part of your code/config you are referring to?
"But mix htmx from npm and extensions in script tag doesn't work"
The problem is not clearly described. Always include code examples and detailed steps to reproduce when filing Issues
@believelody thank you - this is a very relevant question.
All extensions can be installed using npm. The package naming is htmx-ext-extension-name (replace extension-name with the name of the extension), except for idiomorph. See for example htmx-ext-preload npm package. I have opened a PR which adds npm installation instructions to the extension documentation.
Extensions can currently be imported as ESM modules with this workaround. I have opened another PR to make it possible to integrate them with a clean ESM approach like this:
import `htmx.org`;
import `htmx-ext-extension-name`; // Replace `extension-name` with the extension name