An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

![](https://raw.github.com/sinclairzx81/magnum/master/logo.png)

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)


## overview

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


## example

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