]> piware.de Git - webcomponents.git/commitdiff
Add cdn.html: Single document without any additional local resources
authorMartin Pitt <martin@piware.de>
Fri, 1 Nov 2019 16:58:31 +0000 (17:58 +0100)
committerMartin Pitt <martin@piware.de>
Fri, 1 Nov 2019 16:58:31 +0000 (17:58 +0100)
That is the simplest way which avoids any kind of packaging, npm, etc.
It's also the slowest.

cdn.html [new file with mode: 0644]

diff --git a/cdn.html b/cdn.html
new file mode 100644 (file)
index 0000000..115a00c
--- /dev/null
+++ b/cdn.html
@@ -0,0 +1,25 @@
+<head>
+    <title>lit-html CDN example</title>
+    <meta charset="utf-8">
+</head>
+
+<script type="module">
+import { LitElement, html } from "https://cdn.pika.dev/lit-element";
+
+class HelloWorld extends LitElement {
+  render() {
+    return html`<p>Hello world! Came here from ${document.referrer}</p>`;
+  }
+}
+
+customElements.define('hello-world', HelloWorld);
+</script>
+
+<body>
+
+<h1>lit-html CDN examples</h1>
+
+<h3>Hello World</h3>
+<hello-world />
+
+</body>