Skip to content

🪰☕️ Minimalist templating tool for TypeScript :{

Notifications You must be signed in to change notification settings

NicolasHov/mouchetasse

Repository files navigation

🪰☕️ Mouchetasse {

npm version

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>
  • Result :
Hello Dragon, do you fly?

Unit tests

Run the test:

npm jest

ROADMAP

  • Add conditionnals

  • make it work for mardkown...