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.
- 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
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 :)
You have a few options for using Veil :-
- If you are using Nancy then install the Nancy.ViewEngines.Veil package and your preferred syntax parsers e.g. Veil.Handlebars or Veil.SuperSimple
- 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" });
}
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>