🪰☕️ Mouchetasse
Minimalist templating tool in typescript
Get started
Install the package
npm install mouchetasse
Example to try it
- In index.ts, add:
import { readFileSync } from 'fs'
import compile from 'mouchetasse'
const express = require('express')
const app = express();
const port = 3000
app.get('/', (_: any, res: any) => {
const html: string = readFileSync("index.html", { encoding: "utf8" })
const data = { }
res.send(compile(html, data))
})
app.listen(port, () => {
console.log(`Example app listening on port http://localhost:${port}`)
})
2. In index.html, add:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Hello {{name}}, wanna do some {{passion}}</h1>
</body>
</html>