-
Notifications
You must be signed in to change notification settings - Fork 0
Flxble.Templating
Flxble.Templating is an end-user (sandboxed) templating engine built for flxble.
However, you can use it as a separate templating library, and it is the best templating library for F#!
Flxble.Templating is written entirely in F# and can be easily used from F# too.
The common workflow is:
open Flxble.Templating
open System.Text
let context =
TemplateContext.create
CultureInfo.InvariantCulture
(sprintf "<!-- %s -->") // comment out error messages for HTML
let template = Template.loadFile Encoding.UTF8 "test.html"
let result = template |> Template.renderToString contextHave you tired of those fake "functional" scripting languages?
Flxble.Templating has real pipe operators |>, real function compositions >>, real lambda abstractions fun x -> .., and real map/filter/fold functions which utilize them.
See Flxble.Templating: The language for details.
Unlike any other .NET templating engines, Flxble.Templating does not use mutable states for evaluation context. Instead, it uses persistent data structures which are completely thread-safe.
So, you can safely run arbitrary many numbers of render processes at the same time, which can drastically reduce the execution time!
Flxble.Templating is 1.2x to 7.3x times faster compared to the famous .NET end-user templating engines. Since it is completely thread-safe (unlike most of the other ones), it can be even faster with parallelism!
See Flxble.Templating: Benchmarks for details.
It supports netstandard1.6 or later and can be installed from NuGet:
PM> Install-Package Flxble.Templating
$ dotnet add package Flxble.Templating