Skip to content
/ torx Public

The TypesScript template engine for Node.

Notifications You must be signed in to change notification settings

torxjs/torx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Torx

Torx is the TypeScript template engine for Node.

Installation

Torx is designed to run from the command line, as an Express template engine, or as a Node package.

npm install -g torx

Syntax

Execute and render TypeScript variables using the @ symbol.

<button>@label</button>

Escape @ by using it twice, @@.

<p>@@username</p>

This example creates a square with 5 stripes.

@{
   const imageSize = 200;
   const stripeHeight = 20;
}
<svg width="@imageSize" height="@imageSize" xmlns="http://www.w3.org/2000/svg">
   @for (let index = 0; index < 5; index++) {
      <rect x="0" y="@(index * stripeHeight * 2)" width="@imageSize" height="@stripeHeight" />
   }
</svg>

Usage

torx file.torx out/file.html