bigskysoftware / bigskysoftware/htmx
[version 2.0.0-beta4] New HTMX version with Web Components
- Dominant language
- JavaScript
- Stars
- 49.4k
- Forks
- 1.7k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 30
Description
I'm tring to follow instructions from the below link, however it doesn't seem to work.
Basically when I try to do this `htmx.process`, it says the function `process` doesn't exist.
I'm using typescript as well, not sure if it's related, but it could be. ~I can provide a complete sample project if needed.~
https://v2-0v2-0.htmx.org/examples/web-components/
The above doesn't happen with the current latest version `1.9.12`.
Here's the code: https://github.com/renannprado/htmx-issue-2579
Edit:
It seems I managed to fix the issue (I'll push the changes later to the sample repo).
It basically boils down to how I import HTMX.
I'm ignorant when it comes to the different javascript modules, so it was basically trial and error.
I can't explain why it works, but it works.
```typescript
import htmx from "htmx.org/dist/htmx.esm.js";
declare global {
interface Window {
htmx: typeof htmx
}
}
window.htmx = htmx
```
Edit 2:
Even though things seem to work just fine now, I still have doubts whether I'm doing it right or not.
In the sense of: am I supposed to import `htmx.esm.js` and do this `declare global` thingy?
Contributor guide
Assessment
This issue has not been assessed yet.