layout | title |
---|---|
default |
Cottle - High performance & lightweight template library for .NET |
Cottle is an open-source (MIT) templating engine for C# .NET designed to be light (no external dependency & simple API), fast (see benchmark) and extensible (see advanced features). Cottle language and C# API look like this:
{library} is a great library to {["discover", "learn", "use"][rand(0, 3)]}!
var document = Document.CreateDefault(template).DocumentOrThrow;
return document.Render(Context.CreateBuiltin(new Dictionary<Value, Value>
{
["library"] = "Cottle"
}));
Cottle is a great library to learn!
User documentation is available at Read the Docs and explains how to use the library with many code snippets and examples.
Performance benchmark against similar libraries shows how Cottle performs compared to other equivalent template engines.
This project is open-source, released under MIT licence. See license page for details.