include-content
Lazy-load, unload, and portal views with a single HTML element — no app JavaScript required.
Visit websiteOverview
A page with five heavy views loads them all at once, and the one below the fold costs a visitor a second they never asked to spend. The usual fix is a pile of JavaScript watching scroll position and toggling visibility by hand.
include-content is a custom element that renders a view exactly when and where you need it — lazy-loading, unloading, and portalling included — with no app JavaScript at all.
What it does
- Lazy (un)load — views activate as they scroll into view and unload when they leave
- Eager or idle — prioritize critical content, defer the rest, prefetch templates so they're ready on activate
- Shared or remote templates — point at a DOM template or a URL
- Choose the host — portal into light DOM, a shadow root, an author iframe, or any selector
- Keep state — reuse the same tree across toggles, so form values and scroll position survive
How it runs
MIT-licensed npm package @excom/include-content 0.1.4, part of NucleusKit. Install with npm or load it from a CDN; it has zero peer dependencies and needs Node 24.13+ to build.
Who it is for
Front-end developers building HTML-first apps who want sophisticated lazy rendering without hand-writing intersection-observer plumbing.