Skip to content

Instantly share code, notes, and snippets.

@matthewharwood
Forked from nsivertsen/import_map.json
Last active April 7, 2020 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewharwood/e0bfba1f52fd9831a6c5a243212be5e2 to your computer and use it in GitHub Desktop.
Save matthewharwood/e0bfba1f52fd9831a6c5a243212be5e2 to your computer and use it in GitHub Desktop.
Preact and htm on Deno
deno --importmap=import_map.json main.tsx
{
"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