Skip to content

Meh weird template engine trying to get the best performance possible

License

Notifications You must be signed in to change notification settings

Aiko-Suzuki/uwu-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weird template engine 👉👈

use at your own risk am making this for fun

Performance benchmark 🔥

benchmark

How to use

// example using deno: https://deno.land/
import { compile } from "https://cdn.jsdelivr.net/gh/Aiko-Suzuki/uwu-template@main/bundle.js";
const template = Deno.readTextFileSync("bench/test.nnt");
const compiled = compile(template);

const data = {
	title: "Test Title 1",
	slug: "test-title-1",
	id: 1,
	type: "TV",
	startdate: "2020-01-01",
	visible: true,
};

const result = compiled([data]);
console.log(result);

Helper

registerHelper("JSON",(data) => {
  return JSON.stringify(data)
})
// {{JSON users}}

supported block

  • if 🟢
  • each 🟢
  • elseif 🟢

default helper

  • json
  • raw