<wc-include> Include HTML from an External Source
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