vanilla-poc-mm

A vanilla web component for including external media

Usage no npm install needed!

<script type="module">
  import vanillaPocMm from 'https://cdn.skypack.dev/vanilla-poc-mm';
</script>

README

GitHub Releases NPM Release Bundlephobia MIT License Published on WebComponents.org Latest Status Release Status

A Vanilla Web Component for including external media, like an iFrame but better


Installation

npm i @vanillawc/wc-include

Then import the index.js file at the root of the package.


Usage

Attributes

  • shadow - if present the contents are contained in a shadowDOM

Basic Usage

The src attribute imports the contents of the file into the lightDOM.

<wc-include src="./sample.html"></wc-include>

'shadow' Attribute Usage

When the shadow attribute is specified, the imported contents will be encapsulated in a shadowDOM.

<wc-include src="./sample.html" shadow></wc-include>

Demo

WC-Include-Demo - WebComponents.dev