https://github.com/sinclairzx81/magnum
general purpose template engine for nodejs.
https://github.com/sinclairzx81/magnum
node razor templates typescript
Last synced: about 1 year ago
JSON representation
general purpose template engine for nodejs.
- Host: GitHub
- URL: https://github.com/sinclairzx81/magnum
- Owner: sinclairzx81
- License: mit
- Created: 2013-12-25T03:28:40.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-12-28T05:56:16.000Z (over 12 years ago)
- Last Synced: 2025-04-12T16:13:48.321Z (about 1 year ago)
- Topics: node, razor, templates, typescript
- Language: TypeScript
- Homepage:
- Size: 230 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README

A fast, easy to use, general purpose template view engine for nodejs.
### install
npm install magnum
### contents
* [overview](#overview)
* [example](#example)
* [api](#api)
* [render](#render)
* [compile](#compile)
* [context](#context)
* [syntax](#syntax)
* [expressions](#expressions)
* [if statements](#if)
* [for statements](#for)
* [comments](#commentblock)
* [code blocks](#codeblock)
* [layouts](#layouts)
* [import](#import)
* [render](#render)
* [express](#express)
Magnum is a general purpose logic driven templating engine for nodejs developers. Magnum templates allow developers to easily script
complex view logic with a javascript like syntax. Magnum focuses on being general purpose to enable developers can leverage it for
code generation, html templates, xml or other niche template scenarios.
Inspired by Microsoft Razor
The following is a quick example demonstrating rendering a template.
#### layout.html
```html
@section header
@section body
```
#### view.html
```html
@import 'layout.html'
@section header {
@(context.title)
Welcome
@section body
@section footer {
copyright 2013
}
@render 'navigation.html'
@section content