keikan

0.1.1 • Public • Published

Keikan (景観)

Version Author: Diogo Resende Lint CI Coverage License

This is a node.js template module. It's based on EJS, written in ES6 with simplicity in mind.

Install

npm i keikan

Usage

First, assume we have a file named path/to/file.html with the following contents:

<h3>
	Hello
	<strong><%= name %></strong>
</h3>

Then, you could compile and render this file with the following code:

import { Renderer } from "keikan"

const keikan = new Renderer({ debug : true });
const view   = await keikan.compilePath("path/to/file");

console.log(view({ name: "Diogo" }));

The example will print:

<h3>
	Hello
	<strong>Diogo</strong>
</h3>

If debug flag is disabled or not present, it would instead print:

<h3>Hello
<strong>Diogo</strong></h3>

It will try to remove spaces where it know they're not needed.

Express Usage

import * as Keikan from "keikan"
import express     from "express"

const app = express();

app.engine("html", Keikan.renderPath);
app.set("view engine", "html");

// ...

Readme

Keywords

Package Sidebar

Install

npm i keikan

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

137 kB

Total Files

24

Last publish

Collaborators

  • dresende