Fluid.MapActionViewEngine 2.2.1

Suggested Alternatives

MinimalApis.LiquidViews

dotnet add package Fluid.MapActionViewEngine --version 2.2.1
NuGet\Install-Package Fluid.MapActionViewEngine -Version 2.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fluid.MapActionViewEngine" Version="2.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fluid.MapActionViewEngine --version 2.2.1
#r "nuget: Fluid.MapActionViewEngine, 2.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Fluid.MapActionViewEngine as a Cake Addin
#addin nuget:?package=Fluid.MapActionViewEngine&version=2.2.1

// Install Fluid.MapActionViewEngine as a Cake Tool
#tool nuget:?package=Fluid.MapActionViewEngine&version=2.2.1

MinimalApis.LiquidViews

This library provides some extensions to ASP.NET Minimal APIs that allow to return templated view results using the Liquid language. Liquid is fast and safe. Views are interpreted so changes are reflected very quickly without a compilation phase.

Sample usage

These files demonstrates how to return a view result, which will be able to use

  • a _layout file to act as a template for multiple pages
  • a _viewstart file to be executed for each view
  • a component file to act like partial views
Program.cs
var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddFluid();

var app = builder.Build();

// Configure the HTTP request pipeline.

app.MapGet("/", () => Results.Extensions.View("Index", new Todo(1, "Go back to work!", false)));

await app.RunAsync();

record Todo(int Id, string Name, bool IsComplete);
index.liquid
<hr />
Hello World from the body

Name: {{ Name }} <br />
IsComplete: {{ IsComplete}}
<hr />

{% section footer %}
Hello from the footer section
{% endsection %}
_viewstart.liquid
{% layout '_Layout' %}
From /Views/_ViewStart.liquid
component.liquid
<div>Using a component {{ x }} + {{ y }} = {{ x | plus: y }}</div>
_layout.liquid
<!doctype html>
<html lang="en">
  <head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>

  <div class="px-4 py-5 my-5 text-center">
    <h1 class="display-5 fw-bold">Title from the layout</h1>
  <div class="col-lg-6 mx-auto">
    <p class="lead mb-4">
		{% renderbody %}

		{% partial 'Component', x: 1, y:2 %}

	</p>
  </div>
</div>

	<pre>
	{% rendersection footer %}
	</pre>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
  </body>
</html>
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.1 1,847 11/20/2021