2.2.1 • Published 3 years ago

embeddable-content v2.2.1

Weekly downloads
59
License
Apache-2.0
Repository
github
Last release
3 years ago

vanilla JS Custom Element for client-side transclusion

Usage

$ npm install embeddable-content
import "embeddable-content";
<embeddable-content>
    <a href="/path/to/html">details</a>
</embeddable-content>
  • <embeddable-content cors> enables transclusion across origins
  • <embeddable-content replace> disposes of the <embeddable-content> wrapper element upon transclusion

There's also a variant for imperatively updating transcluded content via morphdom:

import RefreshableEmbeddableContent from "embeddable-content/refreshable";

customElements.define("embeddable-content", RefreshableEmbeddableContent);

// periodically refresh transclusions
setInterval(_ => {
    let nodes = document.querySelectorAll("embeddable-content");
    [...nodes].forEach(node => {
        node.refresh();
    });
}, 60 * 1000);

(note that morhpdom is not included as a dependency of this package)

Contributing

  • ensure Node is installed
  • npm install downloads dependencies
  • npm run compile performs a one-time compilation, generating dist/embeddable-content.js (via faucet-pipeline)
  • npm start automatically recompiles while monitoring code changes
  • npm test checks code for stylistic consistency
2.2.1

3 years ago

2.2.0

4 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

1.0.0-beta.0

6 years ago