2021-03-18 10:55:55 +00:00
2021-03-15 18:22:41 +00:00
2021-03-15 18:22:41 +00:00
2021-03-18 10:55:55 +00:00
2021-03-15 18:22:41 +00:00
2021-03-15 18:22:41 +00:00
2021-03-15 18:22:41 +00:00
2021-03-15 18:22:41 +00:00
2021-03-15 15:24:37 +00:00

HummingbirdMustache

Package for rendering Mustache templates. Mustache is a templating language commonly used in server frameworks for generating HTML files (although it is not limited to HTML). You can find out more about Mustache here.

Usage

Load your templates from the filesystem

let library = HBMustacheLibrary("folder/my/templates/are/in")

This will look for all the files with the extension ".mustache" in the specified folder and attempt to load them.

Render an object with a template

let output = library.render(object, withTemplate: "myTemplate")

HummingbirdMustache will render both dictionaries and objects via Mirror reflection. The following two examples will both produce the same output

let object = ["name": "John Smith", "age": 68]
let output = library.render(object, withTemplate: "myTemplate")

and

struct Person {
    let name: String
    let age: Int
}
let object = Person(name: "John Smith", age: 68)
let output = library.render(object, withTemplate: "myTemplate")
Description
No description provided
Readme Apache-2.0 350 KiB
Languages
Swift 99.2%
Shell 0.5%
Dockerfile 0.3%