| 1 |
|
| 2 |
<!doctype html> |
| 3 |
|
| 4 |
<html lang="en"> |
| 5 |
<head> |
| 6 |
<meta charset="utf-8"> |
| 7 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 8 |
<title><my-element> ⌲ Install</title> |
| 9 |
<link rel="stylesheet" href="../docs.css"> |
| 10 |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono"> |
| 11 |
<link href="../prism-okaidia.css" rel="stylesheet" /> |
| 12 |
<script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script> |
| 13 |
<script src="/node_modules/lit/polyfill-support.js"></script> |
| 14 |
<script type="module" src="../my-element.bundled.js"></script> |
| 15 |
</head> |
| 16 |
<body> |
| 17 |
|
| 18 |
<header> |
| 19 |
<h1><my-element></h1> |
| 20 |
<h2>A web component just for me.</h2> |
| 21 |
</header> |
| 22 |
|
| 23 |
<nav> |
| 24 |
<a href="../">Home</a> |
| 25 |
<a href="../examples/">Examples</a> |
| 26 |
<a href="../api/">API</a> |
| 27 |
<a href="">Install</a> |
| 28 |
</nav> |
| 29 |
<div id="main-wrapper"> |
| 30 |
<main> |
| 31 |
<h1>Install</h1> |
| 32 |
<p><code><my-element></code> is distributed on npm, so you can install it locally or use it via npm CDNs like unpkg.com.</p> |
| 33 |
<h2>Local Installation</h2> |
| 34 |
<pre class="language-bash"><code class="language-bash"><span class="token function">npm</span> i my-element</code></pre> |
| 35 |
<h2>CDN</h2> |
| 36 |
<p>npm CDNs like <a href="">unpkg.com</a> can directly serve files that have been published to npm. This works great for standard JavaScript modules that the browser can load natively.</p> |
| 37 |
<p>For this element to work from unpkg.com specifically, you need to include the <code>?module</code> query parameter, which tells unpkg.com to rewrite "bare" module specifiers to full URLs.</p> |
| 38 |
<h3>HTML</h3> |
| 39 |
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>script</span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>module<span class="token punctuation">"</span></span> <span class="token attr-name">src</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>https://unpkg.com/my-element?module<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><span class="token script"></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>script</span><span class="token punctuation">></span></span></code></pre> |
| 40 |
<h3>JavaScript</h3> |
| 41 |
<pre class="language-html"><code class="language-html">import {MyElement} from 'https://unpkg.com/my-element?module';</code></pre> |
| 42 |
|
| 43 |
</main> |
| 44 |
</div> |
| 45 |
|
| 46 |
<footer> |
| 47 |
<p> |
| 48 |
Made with |
| 49 |
<a href="https://github.com/lit/lit-element-starter-ts">lit-starter-ts</a> |
| 50 |
</p> |
| 51 |
</footer> |
| 52 |
</body> |
| 53 |
</html> |