mouchetasse
v1.0.10
Published
Minimalist templating tool for TypeScript
Downloads
5
Readme
🪰☕️ Mouchetasse {
Minimalist templating tool for TypeScript
Get started
Install the package:
npm install mouchetasse
Quick start example
index.ts
:
import { readFileSync } from 'fs'
import compile from 'mouchetasse'
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
const html = readFileSync("index.html", { encoding: "utf8" })
const data = { name: "Dragon", hobby: "fly"}
res.send(compile(html, data))
})
app.listen(port, () => {
console.log(`Example app listening on port http://localhost:${port}`)
})
index.html
:
<!DOCTYPE html>
<html lang="en">
<body>
<h1>Hello {{name}}, do you {{hobby}}?</h1>
</body>
</html>
Unit tests
Run the test:
npm jest