An open API service indexing awesome lists of open source software.

https://github.com/byronmayne/handlebars.msbuild


https://github.com/byronmayne/handlebars.msbuild

Last synced: 7 months ago
JSON representation

Awesome Lists containing this project

README

          

# Handlebars.MSBuild

Adds a custom MSBuild Task for transforming [Handlebars Templates](https://handlebarsjs.com/) as part of the build process. Define your templates that you want to transform define `HandlebarsTemplate` items.

```xml



```
You can define your templates as files on disk

```hbs
{{! AssemblyMetadata.hbs}}
public static class AssemblyMetadata
{
public static readonly string Name = {{MSBuildProjectName}};
public static readonly Version Version = new Version({{Version}});
}
```

## Properties
There is a wide range of properties that are [already exposed](https://github.com/ByronMayne/Handlebars.MSBuild/blob/main/src/Handlebars.MSBuild/Handlebars.MSBuild.props) but you can also define your own.

```xml

```
Then you can use this value in your template.
```hbs
Hello {{Name}}, Nice to meet you!
```

## Export

### Output Directory

At this point no files will be generated as defining the templates only makes the custom task populated the metadata `TransformedTemplate`. You can either do what you want this this or use one of the following export features.

```xml



```
Writes the generated template to the `bin` directory using the given name.

### NuGet Package
```xml



```
Adds the generated output to the NuGet package that will be generated.

### Compilation
```xml



```
This will add the generated file to the compilation process.