y8

1.0.5 • Public • Published
yate

Yet Another Templating Engine [YATE [Y8]]

A tiny (~440B) templating engine, such as many others, however, this is just wow. Amaze.

The classic selling points

  • 👌 Isomorphic, which means it works in both the server, and the client.
  • 🔥 Fast enough.
  • 🤏 Small enough.
  • 🤩 Simply the best itsy bitsy template engine ever made.

Installation

$ npm i --save y8

Usage

const template = require('y8');

const html = `
<html>
    <title>{{hello}}</title>
    <body>
        <h1>{{hello}}</h1>
        <ul>
            <li>{{tasks.one}}</li>
            <li>{{tasks.two}}</li>
            <li>{{tasks.three}}</li>
        <ul>

        <footer>
            <p>Made in {{madeIn}} by {{author}}<p>
        </footer>
    </body>
</html>
`;

const replacements = {
    hello: 'Hello, World',
    tasks: {
        one: 'This is task one',
        two: 'This is task two',
        three: 'This is task three',
    },
    madeIn: 'Norway',
    author: 'Bjarne Oeverli',
};

template(html, replacements);

/*
<html>
    <title>Hello, World</title>
    <body>
        <h1>Hello, World</h1>
        <ul>
            <li>This is task one</li>
            <li>This is task two</li>
            <li>This is task three</li>
        <ul>

        <footer>
            <p>Made in Norway by Bjarne Oeverli<p>
        </footer>
    </body>
</html>
*/

License

MIT - © Bjarne Oeverli - See LICENSE

Package Sidebar

Install

npm i y8

Weekly Downloads

54

Version

1.0.5

License

MIT

Unpacked Size

9.43 kB

Total Files

11

Last publish

Collaborators

  • bjarneo