template-string-render
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

template-string-render

Basic template engine for Node.js based on template string.

You get all the power of javascript and it's way faster than any other template engine html based.

The goal is to make a template string where you can change the front-end css without changing logic's code, and meanwhile having all intellisense Typescript offers.

Install

npm install template-string-render --save

Usage

In case you're using typescript

import * as tsr from "template-string-render"
console.log(tsr.p("Hello world"));

In case you're using javascript

var str = require("template-string-render");
console.log(tsr.p("Hello world"));

If you want to see how a simple page looks like

npm run liveServerExampleSimple

And to finalise, if you're interested in benchmarking this template engine, i made a little benchmark comparing some templates to template-string

npm run benchmark

Template string vs swig vs jade (all are compiled)

starting to render 100000 templates!
template-string (100000) = 188ms
swig (100000) = 707ms
jade (100000) = 588ms

Benchmarks are located on test/benchmark.

Install

npm i template-string-render

DownloadsWeekly Downloads

0

Version

0.0.9

License

none

Last publish

Collaborators

  • dviejo