@devlop/kobolt
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Latest Stable Version License

kobolt

The most simple template factory in the world!

Turn any <template> into a HTMLElement in a breeze.

Installing

using npm

npm install @devlop/kobolt

Placeholders

Kobolt can automatically replace placeholders in your template using the format {{ placeholder }}.

Usage

<template>
    <div data-description="{{ title }}">
        <h1 id="{{ id }}">{{ title }}</h1>
    </div>
</template>
import kobolt from '@devlop/kobolt';

const templateElement = document.querySelector('template');

const outputElement = kobolt(templateElement, {
    // pass a key value object with any placeholders that should be replaced.
    'title': 'Kobolt',
    'id': 'Co',
});

console.log(outputElement.outerHTML);

// <div data-description="Kobolt">
//     <h1 id="Co">Kobolt</h1>
// </div>

Package Sidebar

Install

npm i @devlop/kobolt

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

4.68 kB

Total Files

9

Last publish

Collaborators

  • johanrosenson