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

just a small note: standalone bundle of htm with preact and preact/signals #239

Open
rozek opened this issue Feb 10, 2023 · 2 comments
Open

Comments

@rozek
Copy link

rozek commented Feb 10, 2023

First of all: thank you very much for this marvelous package!

For my personal needs, however, I "had" to bundle htm not only with preact but also with preact/signals - which surprisingly worked out-of-the-box.

However, I won't open a pull request as this "enhancement" does not add any new functionality but just makes the import a bit more convenient...

Of course, you may close this "issue" whenever you like.

@developit
Copy link
Owner

Hiya! I do think this would be really nice to offer, but as you mentioned it's a bit of a divergence from what the standalone entry has previously included.

FWIW, you can grab a combined version using npm.reversehttp.com (it has a UI for getting combined bundles):

<!DOCTYPE html>
<body>
<script type="module">
import {
  html, h, useSignal, render
} from 'https://npm.reversehttp.com/@preact/signals-core,@preact/signals,htm/preact,preact';

function App() {
  const count = useSignal(0);
  return html`
    <button onClick=${() => count.value++}>
      ${count}
    </button>
  `;
}

render(h(App), document.body);
</script>
</body>

Here's a demo of the above on JSFiddle:
https://jsfiddle.net/developit/6gjqnma9/

@rozek
Copy link
Author

rozek commented Feb 10, 2023

Wow, that's interesting and can be quite useful from time to time!

Thank you very much for the hint!

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

No branches or pull requests

2 participants