htm
htm copied to clipboard
just a small note: standalone bundle of htm with preact and preact/signals
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.
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/
Wow, that's interesting and can be quite useful from time to time!
Thank you very much for the hint!