A .NET library that renders Razor Components to HTML strings, ideal for generating email templates and other HTML content.
BlazorTemplater is a .NET library that enables server-side rendering of Razor Components into HTML strings. It provides a simple and efficient way to generate HTML content, such as email templates, outside of a Blazor web application context. It leverages the compile-time advantages of Razor Components over traditional runtime-compiled Razor Views for faster and more flexible HTML generation.
.NET developers who need to generate HTML from Razor Components in non-web contexts, such as for email templating, report generation, or static content creation. It is particularly useful for those already using Blazor and wanting to reuse component logic outside of a Blazor app.
Developers choose BlazorTemplater because it offers a fluent API with type-safe parameter injection, dependency injection support, and layout capabilities, making it more intuitive and flexible than older Razor View-based solutions. It works with standard Razor Components, providing full tooling support and compatibility across .NET Standard 2.0/2.1, .NET Core 3.1, and .NET 5/6.
A library that generates HTML (e.g. for emails) from Razor Components
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The ComponentRenderer uses a fluent interface for easy chaining of operations like .Set() and .AddService(), making configuration intuitive and readable, as demonstrated in the README examples.
Allows setting component parameters with lambda expressions that ensure type safety at compile time, reducing runtime errors and improving developer experience.
Components can use @inject with services provided via .AddService() or a custom IServiceProvider, enabling seamless integration with existing dependency injection containers.
Supports layouts through the @layout attribute or explicit .UseLayout() method, allowing for consistent HTML structures across components, as detailed in the Layouts documentation.
The README explicitly states limitations: it does not support JavaScript, EventCallbacks, or rerendering, restricting use to static HTML generation only.
As admitted in the README, CSS support is not included, and for email templating, additional libraries like PreMailer.NET are needed to inline styles, adding complexity.
Requires enabling Razor SDK in projects, which can be non-trivial for .NET Standard libraries without existing Razor support, as noted in the 'Getting Started' guide.