0.1.1 • Published 3 months ago

keikan v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

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");

// ...
0.1.0

3 months ago

0.1.1

3 months ago

0.0.0

4 months ago