Dartk.ScribanTemplatesGen 0.1.1

Prefix Reserved
dotnet add package Dartk.ScribanTemplatesGen --version 0.1.1                
NuGet\Install-Package Dartk.ScribanTemplatesGen -Version 0.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dartk.ScribanTemplatesGen" Version="0.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dartk.ScribanTemplatesGen --version 0.1.1                
#r "nuget: Dartk.ScribanTemplatesGen, 0.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Dartk.ScribanTemplatesGen as a Cake Addin
#addin nuget:?package=Dartk.ScribanTemplatesGen&version=0.1.1

// Install Dartk.ScribanTemplatesGen as a Cake Tool
#tool nuget:?package=Dartk.ScribanTemplatesGen&version=0.1.1                

ScribanTemplatesGen

C# Source generator that generates static template classes from *.scriban files.

Example

  • Create a file Hello.scriban with the following content

    Hello, {{ arg }}!
    
  • Add it to the project as AdditionalFile

    <ItemGroup>
        <AdditionalFiles Include="Hello.scriban" />
    </ItemGroup>
    
  • The generator will create an internal class ScribanTemplates.Hello

    namespace ScribanTemplates {
        internal class Hello
        {
            public const string FileName = "Hello.scriban";
            public const string Text = """
    Hello, {{ arg }}!
    """;
    
            public static Scriban.Template Parse(
                Scriban.Parsing.ParserOptions? parserOptions = null,
                Scriban.Parsing.LexerOptions? lexerOptions = null)
            {
                return Scriban.Template.Parse(Text, FileName, parserOptions, lexerOptions);
            }
        }
    }
    
  • Now you can use the generated class ScribanTemplates.Hello

    Scriban.Template helloTemplate = ScribanTemplates.Hello.Parse();
    Console.WriteLine(helloTemplate.Render(new { arg = "World" });    // Hello, World!
    
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.1 286 12/1/2023