Skip to content

csainty/Veil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Veil

Veil is a .NET template renderer / view engine. It is designed to support many syntax parsers which sit on top of a single optimized compiler. See Veil.SuperSimple and Veil.Handlebars for examples of supported syntax.

Design Goals

  • Easy to install, configure and use in any project
  • Fastest view engine available
  • Support for explicit flush to aid in browser performance
  • Cross-platform support

Not supported

Unlike Razor, Veil templates are not compiled with the full .NET compilers. This is part of what makes Veil so much easier to integrate and work with. The cost of this approach is that arbitrary code blocks are not supported. A purist may argue this is actually a good thing :)

Getting Started

You have a few options for using Veil :-

  1. If you are using Nancy then install the Nancy.ViewEngines.Veil package and your preferred syntax parsers e.g. Veil.Handlebars or Veil.SuperSimple
  2. Alternatively you can install and use any Veil syntax parser directly in any application. E.g.
Install-Package Veil.Handlebars

// Compile your template once with the chosen parser
var template = "Hello {{ Name }}";
var compiledTemplate = new VeilEngine().Compile<ViewModel>("handlebars", new StringReader(template));

--

// Execute your template as needed
using (var writer = new StringWriter()) {
    compiledTemplate(writer, new ViewModel { Name = "Bob" });
}

Further Information

Builds

Build status

Pre-built binaries of the latest commit are always available at https://ci.appveyor.com/project/csainty/veil/build/artifacts

Alternatively you can grab them from the AppVeyor nuget feed -

<packageSources>
    <add key="veil.appveyor" value="https://ci.appveyor.com/nuget/veil" protocolVersion="2" />
</packageSources>