https://github.com/vanillawc/wc-include
A vanilla web component for including external media
https://github.com/vanillawc/wc-include
htmlelement javascript vanillajs web-components
Last synced: 8 months ago
JSON representation
A vanilla web component for including external media
- Host: GitHub
- URL: https://github.com/vanillawc/wc-include
- Owner: vanillawc
- License: mit
- Created: 2019-04-17T04:21:23.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2021-05-15T18:42:21.000Z (about 5 years ago)
- Last Synced: 2025-03-20T18:11:15.439Z (about 1 year ago)
- Topics: htmlelement, javascript, vanillajs, web-components
- Language: JavaScript
- Homepage:
- Size: 124 KB
- Stars: 20
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
<wc-include> Include HTML from an External Source
## Installation
*Installation*
```sh
npm i @vanillawc/wc-include
```
*Import from NPM*
```html
```
*Import from CDN*
```html
```
## Demo
Try it on [WebComponents.dev](https://webcomponents.dev/edit/zNPKE4KD6k8Lz8wVfHne?sv=1&pm=1)
## 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.
```html
```
### 'shadow' Attribute Usage
When the `shadow` attribute is specified, the imported contents will be encapsulated in a shadowDOM.
```html
```
## Contributing
See [CONTRIBUTING.md](https://github.com/vanillawc/vanillawc/blob/main/CONTRIBUTING.md)