Skip to content

A single, standalone version of Preact, HTM and Preact Signals. No external dependencies, just one single file.

Notifications You must be signed in to change notification settings

kieranbarker/preact-htm-signals-standalone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Preact + HTM + Preact Signals standalone

A single, standalone version of Preact, HTM and Preact Signals. No external dependencies, just one single file.

Usage

Direct CDN import

<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>

Via npm (not recommended)

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

Motivation and goals

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.

Building from source

Install and bundle them (via Microbundle):

git clone 
cd preact_htm_signals_standalone
pnpm i
pnpm run bundle

About

A single, standalone version of Preact, HTM and Preact Signals. No external dependencies, just one single file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%