https://github.com/byronmayne/handlebars.msbuild
https://github.com/byronmayne/handlebars.msbuild
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/byronmayne/handlebars.msbuild
- Owner: ByronMayne
- License: mit
- Created: 2025-01-12T02:45:41.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-01-19T23:12:06.000Z (9 months ago)
- Last Synced: 2025-01-20T00:20:10.769Z (9 months ago)
- Language: C#
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE
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.