A single, standalone version of Preact, HTM and Preact Signals. No external dependencies, just one single file.
<div id="app"></div>
<script type="module">
import { html, render, signal } from "standalone.js";
const count = signal(0);
function App() {
return html`
<div>
<h1 class>Hello World!</h1>
<button onClick=${() => (count.value += 1)}>
Increment with signal
</button>
<p>Counter: ${count}</p>
</div>
`;
}
render(html`<${App} />`, document.getElementById("app"));
</script>
I don't recommend installing this package via NPM. It's best to install the packages separately:
npm install preact htm @preact/signals
# or yarn
yarn add preact htm @preact/signals
# or pnpm
pnpm install preact htm @preact/signals
Main motivation is to use Preact + HTM + Preact Signals directly via CDN in a single script tag/import without any build step. Inspired by the standalone version of Preact + HTM.
All rights belong to Preact, HTM and Preact Signals owners/maintainers.
Install and bundle them (via Microbundle):
git clone
cd preact_htm_signals_standalone
pnpm i
pnpm run bundle