Installation
Install
<o-embed>
is available on npm. You can install it locally or use a CDN like unpkg.com.
Local Installation
npm i @social-embed/wc
yarn add @social-embed/wc
pnpm add @social-embed/wc
CDN
Services like unpkg.com can serve published npm packages directly as ES modules. For unpkg.com, you’ll need to append ?module
so that bare import specifiers are automatically rewritten.
HTML
<script type="module" src="https://unpkg.com/@social-embed/wc?module"></script>
<o-embed url="https://youtu.be/Bd8_vO5zrjo" allowfullscreen></o-embed><o-embed url="https://www.youtube.com/watch?v=NB5hH3ksvKE" allowfullscreen></o-embed>
Try it on CodePen, or check the Playground from the top menu for more demos.
JavaScript
import { OEmbedElement } from "https://unpkg.com/@social-embed/wc?module";