1.0.1 • Published 4 years ago

@devlop/kobolt v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

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>