xoofx / SharpRazor

A lightweight templating system using Razor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SharpRazor

SharpRazor is a lightweight templating system based on the powerful Razor templating stack.

Usage

var razorizer = new Razorizer();
var result = razorizer.Parse("<p>Hello @Model.Name!</p>", new { Name = "Razor" });

Output:

<p>Hello Razor!</p>

Features

SharpRazor provides the following features:

  • Simple and easy interface, with a single entry point Razorizer class and mainly two methods:
  • Razorizer.Parse to directly parse a template
  • Razorizer.Compile to precompile template page
  • C# Code Language and HTML Markup Language (aka cshtml files)
  • MVC3 Model aka @model directive
  • MVC3 Layout and Sections
  • Caching of generated page template types
  • Custom page template class inheriting from SharpRazor.PageTemplate<TModel>
  • Allow debugging of template code (breakpoints, step-in...etc. from VS debugger) when loading template from a location on the disk (By specifying a templateFilePath).
  • Very lightweight, packed into an assembly weighting less than 40Kb (without counting System.Web.Razor dependency)
  • Compatible with .NET 4.5+ and System.Web.Razor 3.0

Available from Nuget

You can download SharpRazor binaries directly from nuget.

License

MIT

About

A lightweight templating system using Razor

License:MIT License


Languages

Language:C# 99.6%Language:Shell 0.4%