0.4.4 • Published 12 months ago

keikan v0.4.4

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

Keikan (景観)

Version Author: Diogo Resende Lint CI Coverage Maintainability 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");

// ...

Options

import { Renderer } from "keikan"

// defaults
const keikan = new Renderer({
	debug     : false,            // true/false
	extension : "html",           // will be appended to view names if name does not end with .html
	resolver  : Resolver("html"), // internal resolver (path, base_path)
});
0.4.4

12 months ago

0.4.3

12 months ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.4.1

1 year ago

0.2.3

1 year ago

0.4.0

1 year ago

0.2.2

1 year ago

0.4.2

1 year ago

0.1.0

2 years ago

0.1.1

2 years ago

0.0.0

2 years ago