templace

0.1.1 • Public • Published

templace

Progressively load template content via JavaScript. Useful for wrapping low-priority heavy content like iframe embeds such to load after initial page load and only when JavaScript is enabled

npm install templace

usage

<template data-templace>
  <iframe src="..."></iframe>
</template>

Include script late in page for best performance benefits

<script src="templace.js" async defer></script>

Templacements happen automagically when the script loads or anytime you invoke the export

templace()

Normalize template CSS for browsers without support

template {
  display: none;
}

status

It's a simple minimum viable package with more granular features in consideration

demo

https://ryanve.github.io/templace/

Package Sidebar

Install

npm i templace

Weekly Downloads

9

Version

0.1.1

License

CC0-1.0

Unpacked Size

10.8 kB

Total Files

7

Last publish

Collaborators

  • ryanve