Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension docs: npm, bundler, min/unmin and SRI hash instructions #3078

Closed
wants to merge 56 commits into from

Conversation

marisst
Copy link
Contributor

@marisst marisst commented Dec 14, 2024

Pull request should be viewed together with the corresponding PR in htmx-extensions repository bigskysoftware/htmx-extensions#123.

Documentation is updated to elaborate on extension installation and integration. Until now, extension installation instructions were limited to a CDN script tag. This change adds:

@marisst marisst changed the title Extension documentation: add npm/bundler installation guides and up versions Extension documentation: add npm/bundler installation and up versions Dec 14, 2024
@Telroshan Telroshan added the documentation Improvements or additions to documentation label Dec 15, 2024
@marisst marisst marked this pull request as draft December 15, 2024 08:36
@marisst
Copy link
Contributor Author

marisst commented Dec 15, 2024

@Telroshan please don't review it yet. I converted to draft. Unfortunately I realised it won't be as easy as this. When integrating an extension with import statement, we need to figure out how to inject htmx in the scope of the extension. I think we also need to update all extension package definitions to make htmx.org a required dependency. I will need to investigate how this is done in other JS libraries. If you have good examples let me know.

@Telroshan
Copy link
Collaborator

Don't worry @marisst , I'm terribly ignorant about this topic anyway so I will likely not be the one to review this 😆

@marisst marisst changed the title Extension documentation: add npm/bundler installation and up versions Update extension installation documentation: npm, esm, min Dec 19, 2024
@marisst marisst changed the title Update extension installation documentation: npm, esm, min Update extension installation documentation: npm, esm, min, sri hash Dec 19, 2024
@marisst marisst changed the title Update extension installation documentation: npm, esm, min, sri hash Extension installation documentation: add instructions for npm and bundlers, provide SRI hash Dec 19, 2024
@marisst marisst changed the title Extension installation documentation: add instructions for npm and bundlers, provide SRI hash Extension docs: add npm installation, bundler integration and SRI hash instructions Dec 19, 2024
@marisst marisst changed the title Extension docs: add npm installation, bundler integration and SRI hash instructions Extension docs: add npm, bundler and SRI hash instructions Dec 19, 2024
@marisst marisst marked this pull request as ready for review December 19, 2024 19:59
@marisst marisst changed the title Extension docs: add npm, bundler and SRI hash instructions Extension docs: add npm installation, bundler integration, min/unmin access and SRI hash instructions Dec 19, 2024
@marisst marisst changed the title Extension docs: add npm installation, bundler integration, min/unmin access and SRI hash instructions Extension docs: add npm, bundler, min/unmin version and SRI hash instructions Dec 19, 2024
@marisst marisst changed the title Extension docs: add npm, bundler, min/unmin version and SRI hash instructions Extension docs: npm, bundler, min/unmin version and SRI hash instructions Dec 19, 2024
@Telroshan
Copy link
Collaborator

Finally caught up with issues & PRs I had missed during holidays, I'll be reviewing these PRs (this one, the other in the extensions repo as well as the other webpack/Vite PR open on this repo) over the next couple days @marisst , as there is no esm expert available among us unfortunately (I'll take some time to dive into this whole topic first 😄 )
I'll keep you informed!

After installing, you'll need to use appropriate tooling to bundle `node_modules/htmx-ext-extension-name/dist/extension-name.js` (or `.min.js`). For example, you might bundle the extension with htmx core from `node_modules/htmx.org/dist/htmx.js` and project-specific code.

If you are using a bundler to manage your javascript (e.g. Webpack, Rollup):
- Install `htmx.org` and `htx-ext-extension-name` via npm (replace `extension-name` with the name of the extension)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely a typo

Suggested change
- Install `htmx.org` and `htx-ext-extension-name` via npm (replace `extension-name` with the name of the extension)
- Install `htmx.org` and `htmx-ext-extension-name` via npm (replace `extension-name` with the name of the extension)

import `htmx-ext-extension-name`; // replace `extension-name` with the name of the extension
```

Note: [Idiomorph](/extensions/idiomorph) does not follow the naming convention of htmx extensions. Use `idiomorph` instead of `htmx-ext-idiomorph`. For example, `https://unpkg.com/idiomorph` or `npm install idiomorph`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth it to add another note here, to explain that community extensions might have different installation instructions (for the ones that aren't hosted on our extensions repo)?
And that the reader should check the extension's repo where the owner would have added documentation as to how to set it up, which may differ from ours

After installing, you'll need to use appropriate tooling to bundle `node_modules/htmx-ext-head-support/dist/head-support.js` (or `.min.js`). For example, you might bundle the extension with htmx core from `node_modules/htmx.org/dist/htmx.js` and project-specific code.

If you are using a bundler to manage your javascript (e.g. Webpack, Rollup):
- Install `htmx.org` and `htx-ext-head-support` via npm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely a typo

Suggested change
- Install `htmx.org` and `htx-ext-head-support` via npm
- Install `htmx.org` and `htmx-ext-head-support` via npm

After installing, you'll need to use appropriate tooling to bundle `node_modules/htmx-ext-htmx-1-compat/dist/htmx-1-compat.js` (or `.min.js`). For example, you might bundle the extension with htmx core from `node_modules/htmx.org/dist/htmx.js` and project-specific code.

If you are using a bundler to manage your javascript (e.g. Webpack, Rollup):
- Install `htmx.org` and `htx-ext-htmx-1-compat` via npm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely a typo

Suggested change
- Install `htmx.org` and `htx-ext-htmx-1-compat` via npm
- Install `htmx.org` and `htmx-ext-htmx-1-compat` via npm

After installing, you'll need to use appropriate tooling to bundle `node_modules/htmx-ext-preload/dist/preload.js` (or `.min.js`). For example, you might bundle the extension with htmx core from `node_modules/htmx.org/dist/htmx.js` and project-specific code.

If you are using a bundler to manage your javascript (e.g. Webpack, Rollup):
- Install `htmx.org` and `htx-ext-preload` via npm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely a typo

Suggested change
- Install `htmx.org` and `htx-ext-preload` via npm
- Install `htmx.org` and `htmx-ext-preload` via npm

After installing, you'll need to use appropriate tooling to bundle `node_modules/htmx-ext-response-targets/dist/response-targets.js` (or `.min.js`). For example, you might bundle the extension with htmx core from `node_modules/htmx.org/dist/htmx.js` and project-specific code.

If you are using a bundler to manage your javascript (e.g. Webpack, Rollup):
- Install `htmx.org` and `htx-ext-response-targets` via npm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely a typo

Suggested change
- Install `htmx.org` and `htx-ext-response-targets` via npm
- Install `htmx.org` and `htmx-ext-response-targets` via npm

After installing, you'll need to use appropriate tooling to bundle `node_modules/htmx-ext-sse/dist/sse.js` (or `.min.js`). For example, you might bundle the extension with htmx core from `node_modules/htmx.org/dist/htmx.js` and project-specific code.

If you are using a bundler to manage your javascript (e.g. Webpack, Rollup):
- Install `htmx.org` and `htx-ext-sse` via npm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely a typo

Suggested change
- Install `htmx.org` and `htx-ext-sse` via npm
- Install `htmx.org` and `htmx-ext-sse` via npm

After installing, you'll need to use appropriate tooling to bundle `node_modules/htmx-ext-ws/dist/ws.js` (or `.min.js`). For example, you might bundle the extension with htmx core from `node_modules/htmx.org/dist/htmx.js` and project-specific code.

If you are using a bundler to manage your javascript (e.g. Webpack, Rollup):
- Install `htmx.org` and `htx-ext-ws` via npm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely a typo

Suggested change
- Install `htmx.org` and `htx-ext-ws` via npm
- Install `htmx.org` and `htmx-ext-ws` via npm

jafioti and others added 2 commits January 10, 2025 12:17
* added wasm to htmx port essay

* changed wasm-to-htmx essay

* added image and changed author
@marisst marisst closed this Jan 12, 2025
@marisst
Copy link
Contributor Author

marisst commented Jan 12, 2025

Apologies, I did something wrong in Git and messed up the PR. I opened a new PR for this. #3127

@Telroshan Thank you for the comments. I fixed them in the new PR, in this commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet