pod afBedSheetMoustache

A library for integrating Mustache templates with the BedSheet web framework

Mixins

MoustacheConfigIds

Config values as used by Moustache.

MoustacheTemplates

A cache of Mustache templates.

Errs

MoustacheErr

Indicates a Mustache parsing Err; the stack trace trace contains a code snippet of where the Err occurred.

Overview

BedSheet Moustache is a Fantom library that integrates Mustache templates with the BedSheet web framework.

It provides a cache for your compiled Mustache templates and throws MoustacheErrs to show details of compilation failures.

Example:

Moustache Compilation Err:
  file:/C:/Projects/Fantom/BedSheetMoustache/test/app/compilationErr.moustache : Line 11
    - Unbalanced "{" in tag "{ alienHeadSvg }  <span class="brand">{{ title"

     6:         {{{ bedSheetCss }}}
     7:     </style>
     8: </head>
     9: <body>
    10:     <header>
==> 11:         {{{ alienHeadSvg }
    12:         <span class="brand">{{ title }}</span>
    13:     </header>
    14:
    15:     <main>
    16:         {{{ content }}}

Sections are added to the standard BedSheet Err page to show the same.

Moustache Err in BedSheet

Install

Install BedSheet Moustache with the Fantom Repository Manager ( fanr ):

C:\> fanr install -r http://repo.status302.com/fanr/ afBedSheetMoustache

To use in a Fantom project, add a dependency to build.fan:

depends = ["sys 1.0", ..., "afBedSheetMoustache 1.0+"]

Documentation

Full API & fandocs are available on the Status302 repository.

Quick Start

using afIoc::Inject
using afBedSheet::Text
using afBedSheetMoustache::MoustacheTemplates

const class RouteHandler {

  @Inject
  private const MoustacheTemplates templates

  new make(|This|in) { in(this) }

  Text renderPage() {
    html := templates.renderFromFile(`res/index.moustache`.toFile)
    return Text.fromHtml(html)
  }
}

Release Notes

v1.0.12

v1.0.10

v1.0.8

v1.0.6

v1.0.4

v1.0.2

v1.0.0

v0.0.2

  • New: Preview release.