angel3_mustache 10.0.0
angel3_mustache: ^10.0.0 copied to clipboard
A service that renders Mustache template into HTML view for Angel3
Mustache View Template for Angel3 #
A service that renders Mustache template into HTML view for Angel3 framework.
Thanks so much @c4wrd for his help with bringing this project to life!
Installation #
In pubspec.yaml:
dependencies:
angel3_mustache: ^10.0.0
Usage #
const FileSystem fs = LocalFileSystem();
configureServer(Angel app) async {
// Run the plug-in
await app.configure(mustache(fs.directory('views')));
// Render `hello.mustache`
app.get('/hello', (req, res) => res.render('hello', {'name': 'world'}));
}
Options #
- partialsPath: A path within the viewsDirectory to search for partials in.
Default is
./partials. - fileExtension: The file extension to search for. Default is
.mustache.
Migrating from 9.x to 10.0.0 #
The breaking changes of each release are listed in the CHANGELOG. Those of 10.0.0 that may need changes in an app:
- Views: a view name that resolves outside the views directory (
../secret, an absolute path, a symbolic link out of it), and a missing view, throw a 404AngelHttpException, instead of reading the file or throwing aFileSystemException. - Partials: a partial that resolves outside the partials directory, or does not exist, renders as nothing, as Mustache specifies.