bigskysoftware / bigskysoftware/htmx

[version 2.0.0-beta4] New HTMX version with Web Components

Open
#2,579 0 comments 0 reactions 0 assignees View on GitHub
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

image

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.