platform/packages/mustache/README.md
2024-10-12 18:45:27 -07:00

39 lines
1.2 KiB
Markdown

# Mustache View Template for Protevus
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/protevus_mustache?include_prereleases)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Discord](https://img.shields.io/discord/1060322353214660698)](https://discord.gg/3X6bxTUdCM)
[![License](https://img.shields.io/github/license/dart-backend/protevus)](https://github.com/dart-backend/protevus/tree/master/packages/mustache/LICENSE)
A service that renders Mustache template into HTML view for [Protevus](https://protevus-framework.web.app/) framework.
Thanks so much @c4wrd for his help with bringing this project to life!
## Installation
In `pubspec.yaml`:
```yaml
dependencies:
protevus_mustache: ^8.0.0
```
## Usage
```dart
const FileSystem fs = const LocalFileSystem();
configureServer(Protevus app) async {
// Run the plug-in
await app.configure(mustache(fs.directory('views')));
// Render `hello.mustache`
await 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`.