erazor 1.0.2

A haXe implementation of the MVC 3 Razor template engine

Released 2016-08-24.

To install, run:

haxelib install erazor 1.0.2

See using Haxelib in Haxelib documentation for more information.

Current version1.0.2
StatisticsInstalled 4525 times
Tags cross, template

Erazor Templating Engine

Build Status

More details coming soon. Feel free to send a pull request adding some examples and instructions to this readme!


haxelib install erazor

Basic Usage

Simple variables

var s = new Template("Hello, @name!").execute({name:"World"});
// "Hello, World!"

Function call

var s = new Template("Hello, @getName()!").execute({getName:function() return "World"});
// "Hello, World!"


var s = new Template("@if(success){done!}else{fail!}").execute({success:true});
// "done!"

For loop

var s = new Template("@for(name in names){Hello, @name! }").execute({names:["Peter","Clare","Sandra"]});
// "Hello, Peter! Hello, Clare! Hello, Sandra! "

Code blocks

Use @{ } to wrap some hscript codes. Don't forget the semicolon (;) at the end. With this you can declare some variables for later use.

var s = new Template("@{var p = "Hello, World!";}@p").execute();
// "Hello, World!"

... can somebody send a pull request with some more examples? Thanks!




Many Haxe developers have used erazor, but it has not been clear which fork on Github is the "official" version, with different forks having different fixes and patches applied.

This repository has been created so that there is a central place to contribute, so pull requests, bug reports, and documentation are all welcome!

If you would like direct commit access, send at least one good pull request and we'll let you in! (If you are one of the major contributors already, just ask me: