AF-BedSheetMoustacheUser Guide
Overview
BedSheetMoustache
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 afBedSheet Err page to show the same.
Install
Install BedSheetMoustache
with the Fantom Respository Manager:
C:\> fanr install -r http://repo.status302.com/fanr/ afBedSheetMoustache
Or download the pod from Status302 and copy it to %FAN_HOME%/lib/fan/
.
To use in a Fantom project, add a dependency to its build.fan
:
depends = ["sys 1.0", ..., "afBedSheetMoustache 1.0+"]
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.4
- Chg: Updated to use afIocConfig.
v1.0.2
- Chg: Updated to use afPlastic
- Chg: Updated Errs to extend
afPlastic::SrcCodeErr
- Chg: Removed Err Page printing as BedSheet now does generic
SrcCodeErr
. - Chg: Corrected the
vcs.uri
pod meta data - https://bitbucket.org/AlienFactory/afbedsheetmoustache
v1.0.0
- Chg: Renamed the MoustacheConfigIds values.
v0.0.2
- New: Preview release.