platform/packages/mustache/README.md

40 lines
1.2 KiB
Markdown
Raw Normal View History

# Mustache View Template for Protevus
2017-04-05 22:43:15 +00:00
![Pub Version (including pre-releases)](https://img.shields.io/pub/v/protevus_mustache?include_prereleases)
2021-06-26 10:24:52 +00:00
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
2024-07-07 15:02:49 +00:00
[![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)
2021-06-26 10:24:52 +00:00
A service that renders Mustache template into HTML view for [Protevus](https://protevus-framework.web.app/) framework.
2016-04-22 02:22:33 +00:00
2017-04-05 22:43:38 +00:00
Thanks so much @c4wrd for his help with bringing this project to life!
2017-04-05 22:43:15 +00:00
2021-06-26 10:24:52 +00:00
## Installation
2016-04-22 02:22:33 +00:00
In `pubspec.yaml`:
2017-04-05 18:37:26 +00:00
```yaml
dependencies:
protevus_mustache: ^8.0.0
2017-04-05 18:37:26 +00:00
```
2021-06-26 10:24:52 +00:00
## Usage
2017-04-05 18:38:35 +00:00
```dart
2017-11-18 18:39:10 +00:00
const FileSystem fs = const LocalFileSystem();
configureServer(Protevus app) async {
2017-11-18 18:39:10 +00:00
// Run the plug-in
await app.configure(mustache(fs.directory('views')));
// Render `hello.mustache`
await res.render('hello', {'name': 'world'});
}
2016-05-02 23:28:37 +00:00
```
2021-06-26 10:24:52 +00:00
@# Options
2016-05-02 23:28:37 +00:00
- **partialsPath**: A path within the viewsDirectory to search for partials in.
2017-04-05 18:37:47 +00:00
Default is `./partials`.
2017-04-05 18:37:26 +00:00
- **fileExtension**: The file extension to search for. Default is `.mustache`.