BlazorTemplater

screenshot of BlazorTemplater

A library that generates HTML (e.g. for emails) from Razor Components

Overview

BlazorTemplater is a library that generates HTML, particularly for emails, from Razor Components. It provides a fluent interface for rendering components, setting parameters, and injecting services. The library also supports layouts and offers backward compatibility with a templater method. BlazorTemplater can be used in various project types including .NET Standard, .NET Core, and Blazor applications.

Features

  • ComponentRenderer: Provides a fluent interface for rendering components as HTML strings.
  • Parameter Setting: Allows setting parameters on components using a lambda expression, ensuring the value matches the property type.
  • Dependency Injection: Supports specifying services to be provided to a component using @inject.
  • Layouts: Offers the ability to apply a layout to a top-level component using the @layout attribute or explicitly specifying a template.
  • Chaining Multiple Features: Allows chaining different features together in any order, as long as .Render() is the last method.
  • Template Method: Provides compatibility with the older templater method for existing applications.
  • Support for Various Project Types: Works with .NET Standard 2.0, .NET Standard 2.1, .NET Core 3.1, .NET 5, and .NET 6 projects.
  • Razor Component Libraries: Takes advantage of Razor Component Libraries for easier creation of class libraries with Razor-based markup.

Summary

BlazorTemplater is a powerful library that simplifies the generation of HTML, especially for emails, using Razor Components. It offers a range of features such as fluent rendering, parameter setting, dependency injection, and support for layouts. The library can be easily installed and integrated into various types of projects. With BlazorTemplater, developers can create dynamic and customizable HTML templates with ease.