template-extends

0.0.4 • Public • Published

Template Extends

Build-less template inheritance in the browser. Handy for example or demo pages.

layout.html

<template block="head">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</template>

<main>
  <header>header</header>

  <template block="content">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  </template>

  <footer>footer</footer>
</main>

index.html

<!doctype html>
<script type="module" src="https://cdn.jsdelivr.net/npm/template-extends@0/+esm"></script>
<title>template-extends demo</title>

<body>

<template extends="./layout.html">
  <template block="head">
    {{super}}
    <script type="module" src="https://cdn.jsdelivr.net/npm/media-chrome/+esm"></script>
  </template>

  <template block="content">
    <h1>My blog post title</h1>
    <p>{{super}}</p>
  </template>
</template>

/template-extends/

    Package Sidebar

    Install

    npm i template-extends

    Weekly Downloads

    0

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    21.4 kB

    Total Files

    7

    Last publish

    Collaborators

    • luwes