TextTransformationAliases.

TransformTextFile(ICakeContext, FilePath) Method

Summary

Creates a text transformation from the provided template on disc.
Namespace
Cake.Common.Text
Containing Type
TextTransformationAliases

Syntax

[CakeMethodAlias]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Stream reader leaves stream open.")]
public static TextTransformation<TextTransformationTemplate> TransformTextFile(this ICakeContext context, FilePath path)

Examples

This sample shows how to create a TextTransformation<TTemplate> using the specified template file with the placeholder format <%key%>.
string text = TransformTextFile("./template.txt")
   .WithToken("subject", "world")
   .ToString();

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.
SuppressMessageAttribute

Parameters

Name Type Description
context ICakeContext The context.
path FilePath The template file path.

Return Value

Type Description
TextTransformation<TextTransformationTemplate> A TextTransformation<TTemplate> representing the provided template.