Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DotLiquid template engine http handlers for Giraffe web applications.

License

NotificationsYou must be signed in to change notification settings

giraffe-fsharp/Giraffe.DotLiquid

Repository files navigation

Giraffe

Giraffe.DotLiquid

DotLiquid templating engine http handlers for the Giraffe web framework.

NuGet Info

Linux, macOS and Windows Build Status

.NET Core

Build history

Table of contents

Documentation

TheGiraffe.DotLiquid NuGet package adds additionalHttpHandler functions to render DotLiquid templates in Giraffe.

dotLiquid

dotLiquid uses theDotLiquid template engine to set or modify the body of theHttpResponse. This http handler triggers a response to the client and other http handlers will not be able to modify the HTTP headers afterwards any more.

ThedotLiquid handler requires the content type and the actual template to be passed in as two string values together with an object model. This handler is supposed to be used as the base handler for other http handlers which want to utilize the DotLiquid template engine (e.g. you could create an SVG handler on top of it).

Example:

openGiraffeopenGiraffe.DotLiquidtypePerson={        FirstName:string        LastName:string}letfooBar={ FirstName="Foo"; LastName="Bar"}lettemplate="<html><head><title>DotLiquid</title></head><body><p>First name: {{ firstName }}<br />Last name: {{ lastName }}</p></body></html>"letapp=    choose[        route"/foo">=> dotLiquid"text/html" template fooBar]

dotLiquidTemplate

dotLiquidTemplate uses theDotLiquid template engine to set or modify the body of theHttpResponse. This http handler triggers a response to the client and other http handlers will not be able to modify the HTTP headers afterwards any more.

This http handler takes a relative path of a template file, an associated model and the contentType of the response as parameters.

Example:

openGiraffeopenGiraffe.DotLiquidtypePerson={        FirstName:string        LastName:string}letfooBar={ FirstName="Foo"; LastName="Bar"}letapp=    choose[        route"/foo">=> dotLiquidTemplate"text/html""templates/person.html" fooBar]

dotLiquidHtmlTemplate

dotLiquidHtmlTemplate is the same asdotLiquidTemplate except that it automatically sets the response astext/html.

Example:

openGiraffeopenGiraffe.DotLiquidtypePerson={        FirstName:string        LastName:string}letfooBar={ FirstName="Foo"; LastName="Bar"}letapp=    choose[        route"/foo">=> dotLiquidHtmlTemplate"templates/person.html" fooBar]

Samples

Please find a fully functioning sample application under./samples/GiraffeDotLiquidSample/.

Nightly builds and NuGet feed

All official release packages are published to the official and public NuGet feed.

Nightly builds (builds from thedevelop branch) produce unofficial pre-release packages which can be pulled from theproject's NuGet feed on GitHub.

These packages are being tagged with the Workflow's run number as the package version.

All other builds, such as builds triggered by pull requests produce a NuGet package which can be downloaded as an artifact from the individual GitHub action.

More information

For more information about Giraffe, how to set up a development environment, contribution guidelines and more please visit themain documentation page.

License

Apache 2.0

About

DotLiquid template engine http handlers for Giraffe web applications.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Languages


[8]ページ先頭

©2009-2025 Movatter.jp