Skip to content

crutchcorn/tempblot

Repository files navigation

Tempblot

splatter

A modern type-safe templating engine


<!-- Run TypeScript via Node -->
<setup>
import {v4} from "uuid";

const data = {
    hello: !!v4 ? 123 : null
};
</setup>

<!-- Use `lang` to change the syntax highlighting of the `output` block -->
<output lang="json">
{
    "//": "Interpolate values with << >>",
    "test": <<data.hello>>
}
</output>

Passing Params

Pass configuration into a .blot file with compilePath, then read it in the <setup> block with useParams.

import { compilePath } from "tempblot";

const output = await compilePath("./config.json.blot", { name: "Tempblot" });
<setup>
import { useParams } from "tempblot";

const params = useParams<{ name: string }>();
</setup>

<output lang="json">
{
    "name": <<params.name>>
}
</output>

Installation

npm install tempblot

Prerequisites

  • Node v22.18+

About

A modern type-safe templating engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors