Installation

ServiceStack Templates is available in the ServiceStack.Common NuGet Package:

PM> Install-Package ServiceStack.Common

Or if using .NET Core:

PM> Install-Package ServiceStack.Common.Core

You're now all set to play with ServiceStack Templates! Start by creating and rendering a dynamic page:

var context = new TemplateContext().Init();
var dynamicPage = context.OneTimePage("The time is now: {{ now | dateFormat('HH:mm:ss') }}"); 
var output = new PageResult(dynamicPage).Result;

Evaluating ad hoc templates can also be condensed down to a single line:

var output = context.EvaluateTemplate("The time is now: {{ now | dateFormat('HH:mm:ss') }}");

Configure with ServiceStack

To use Template Pages as a HTML View Engine in ServiceStack, register the TemplatePagesFeature plugin:

public void Configure(Container container)
{
    Plugins.Add(new TemplatePagesFeature());
}

Starter Projects

The Starter Projects below provide a quick way to get started with a pre-configured ServiceStack Template Web App.

.NET Core 2.0 Boostrap Starter

Clone the TemplatesBootstrapStarter GitHub project to start from a Bootstrap v4 and jQuery .NET Core 2.0 App:

.NET Core Starter Template

ASP.NET v4.5 Boostrap Starter

For ASP.NET v4.5 projects create a new ServiceStack ASP.NET Templates with Bootstrap from the VS.NET Templates in ServiceStackVS VS.NET Extension to create an ASP.NET v4.5 Project using ServiceStack's recommended project structure:

ASP.NET v4.5 Starter Template

made with by ServiceStack