vanillawc / wc-include

A vanilla web component for including external media

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<wc-include> Include HTML from an External Source

GitHub Releases NPM Releases Bundlephobia Latest Status Release Status

Discord Published on WebComponents.org

Installation

Installation

npm i @vanillawc/wc-include

Import from NPM

<script type="module" src="node_modules/@vanillawc/wc-include/index.js"></script>

Import from CDN

<script type="module" src="https://cdn.jsdelivr.net/gh/vanillawc/wc-include@1/index.js"></script>

Demo

Try it on WebComponents.dev

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>

Contributing

See CONTRIBUTING.md

About

A vanilla web component for including external media

License:MIT License


Languages

Language:JavaScript 80.7%Language:HTML 19.3%