swift-mustache

2.0.0

Mustache templating engine
hummingbird-project/swift-mustache

What's New

v2.0.0

2024-10-18T08:25:37Z

Major changes since 1.x.x

  • Renamed package to swift-mustache and library renamed to Mustache.
  • Implemented proper version of Lambdas from Mustache specification.
  • Add support for partial loading via dynamic names.
  • Added recursive transforms.
  • Fixed issues in inheritance spec.
  • Add development support for reloading templates.
  • Removed HB prefix.

Swift-Mustache

Package for rendering Mustache templates. Mustache is a "logic-less" templating language commonly used in web and mobile platforms. You can find out more about Mustache here.

Usage

Load your templates from the filesystem

import Mustache
let library = MustacheLibrary("folder/my/templates/are/in")

This will look for all the files with the extension ".mustache" in the specified folder and subfolders and attempt to load them. Each file is registed with the name of the file (with subfolder, if inside a subfolder) minus the "mustache" extension.

Render an object with a template

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

Swift-Mustache treats an object as a set of key/value pairs when rendering and will render both dictionaries and objects via Mirror reflection. Find out more on how Mustache renders objects here.

Support

Swift-Mustache supports all standard Mustache tags and is fully compliant with the Mustache spec with the exception of the Lambda support.

Additional features

Swift-Mustache includes some features that are specific to its implementation. Please follow the links below to find out more.

Documentation

Reference documentation for swift-mustache can be found here

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

  • None
Last updated: Wed May 14 2025 19:38:02 GMT-0900 (Hawaii-Aleutian Daylight Time)