Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sfxcode/pebble-scala
A wrapper library for using [Pebble Templates](https://pebbletemplates.io/) in Scala.
https://github.com/sfxcode/pebble-scala
pebble pebble-templates scala template-engine templating
Last synced: 4 months ago
JSON representation
A wrapper library for using [Pebble Templates](https://pebbletemplates.io/) in Scala.
- Host: GitHub
- URL: https://github.com/sfxcode/pebble-scala
- Owner: sfxcode
- License: apache-2.0
- Created: 2020-06-21T15:49:32.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-14T18:48:56.000Z (about 1 year ago)
- Last Synced: 2024-01-14T23:11:31.541Z (about 1 year ago)
- Topics: pebble, pebble-templates, scala, template-engine, templating
- Language: Scala
- Homepage:
- Size: 113 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README
# pebble-scala
A wrapper library for using [Pebble Templates](https://pebbletemplates.io/) in Scala.
Adds first class scala support to Pebble.
## Features
* Resolver for Scala values
* Support Scala Lists, Set, Maps, Options, ...
* Loops support scala collections
* Scala Support for Tests (empty, map, iterable)
* iterate over scala collections
* implement do Tag
* ...## Version
Scala Version is 2.13.x / 3.0.0## SBT
```
libraryDependencies += "com.sfxcode.templating" %% "pebble-scala" % "1.0.2"
```## Travis
[](https://travis-ci.org/sfxcode/pebble-scala)
## Download
[  ](https://bintray.com/sfxcode/maven/pebble-scala/_latestVersion)
## Usage
1. Write Template
```html
{{ info.name }}
- {{ value }}
{% for value in list %}
{% endfor %}
```
2. Init Engine
Scala map with global engine parameter is optional ...
```scala
val Engine: ScalaPebbleEngine = ScalaPebbleEngine(globalContext = Map("header" -> "pebble-scala"))
```
3. Evaluate
```
val context = Map("list" -> List("Resolver for Scala values", "iterate over scala collections"))
val evaluated = Engine.evaluateToString("templates/template.peb", context)
```
4. Result
```html
pebble-scala
- Resolver for Scala values
- iterate over scala collections
```
## Supporters
JetBrains is supporting this open source project with:
[](http://www.jetbrains.com/idea/)