Skip to content

Instantly share code, notes, and snippets.

@nsivertsen
Created April 7, 2020 08:43
Show Gist options
  • Save nsivertsen/b7137c217ef078e59d14e198a660fe7e to your computer and use it in GitHub Desktop.
Save nsivertsen/b7137c217ef078e59d14e198a660fe7e to your computer and use it in GitHub Desktop.
Preact and htm on Deno
deno --importmap=import_map.json main.js
{
"imports": {
"htm": "https://unpkg.com/htm@3.0.3/dist/htm.module.js",
"htm/preact": "https://unpkg.com/htm@3.0.3/preact/index.module.js",
"preact": "https://unpkg.com/preact@10.3.4/dist/preact.module.js",
"preact-render-to-string": "https://unpkg.com/preact-render-to-string@5.1.4/dist/index.module.js"
}
}
import { html } from "htm/preact";
import render from "preact-render-to-string";
function App() {
return html`
<h1>Hello, world!</h1>
`;
}
console.log(render(html`<${App} />`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment