index.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title><my-element> ⌲ Install</title>
  7. <link rel="stylesheet" href="../docs.css">
  8. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
  9. <link href="../prism-okaidia.css" rel="stylesheet" />
  10. <script src="/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
  11. <script src="/node_modules/lit/polyfill-support.js"></script>
  12. <script type="module" src="../my-element.bundled.js"></script>
  13. </head>
  14. <body>
  15. <header>
  16. <h1>&lt;my-element></h1>
  17. <h2>A web component just for me.</h2>
  18. </header>
  19. <nav>
  20. <a href="../">Home</a>
  21. <a href="../examples/">Examples</a>
  22. <a href="../api/">API</a>
  23. <a href="">Install</a>
  24. </nav>
  25. <div id="main-wrapper">
  26. <main>
  27. <h1>Install</h1>
  28. <p><code>&lt;my-element&gt;</code> is distributed on npm, so you can install it locally or use it via npm CDNs like unpkg.com.</p>
  29. <h2>Local Installation</h2>
  30. <pre class="language-bash"><code class="language-bash"><span class="token function">npm</span> i my-element</code></pre>
  31. <h2>CDN</h2>
  32. <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>
  33. <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 &quot;bare&quot; module specificers to full URLs.</p>
  34. <h3>HTML</h3>
  35. <pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</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">&lt;/</span>script</span><span class="token punctuation">></span></span></code></pre>
  36. <h3>JavaScript</h3>
  37. <pre class="language-html"><code class="language-html">import {MyElement} from 'https://unpkg.com/my-element?module';</code></pre>
  38. </main>
  39. </div>
  40. <footer>
  41. <p>
  42. Made with
  43. <a href="https://github.com/PolymerLabs/lit-starter-ts">lit-starter-ts</a>
  44. </p>
  45. </footer>
  46. </body>
  47. </html>