A lightweight templating system using Razor
C# Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
SharpRazor.Tests
SharpRazor
doc
packages
site @ 8091aa0
.gitignore
.gitmodules
License.txt
Readme.md
SharpRazor.sln
SharpRazor.sln.DotSettings
build.bat

Readme.md

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