public class PebbleModule extends Object implements Extension
Usage:
{
install(new PebbleModule());
get("/", ctx -> {
User user = ...;
return new ModelAndView("index.peb")
.put("user", user);
});
}
The template engine looks for a file-system directory: views in the current
user directory. If the directory doesn't exist, it looks for the same directory in the project
classpath.
You can specify a different template location:
{
install(new PebbleModule("mypath"));
}
The mypath location works in the same way: file-system or fallback to classpath.
Template engine supports the following file extensions: .peb, .pebble and .html.
Direct access to PebbleEngine.Builder is available via require call:
{
PebbleEngine.Builder builder = require(PebbleEngine.Builder.class);
}
Complete documentation is available at: https://jooby.io/modules/pebble.
| Modifier and Type | Class and Description |
|---|---|
static class |
PebbleModule.Builder
Utility class for creating
PebbleModule instances. |
| Constructor and Description |
|---|
PebbleModule()
Creates a new PebbleModule module using the default path:
views. |
PebbleModule(com.mitchellbosecke.pebble.PebbleEngine.Builder builder)
Creates a new pebble module.
|
PebbleModule(String templatesPath)
Creates a new PebbleModule module.
|
| Modifier and Type | Method and Description |
|---|---|
static PebbleModule.Builder |
create()
Creates a new PebbleModule.Builder.
|
void |
install(Jooby application) |
public PebbleModule(@Nonnull com.mitchellbosecke.pebble.PebbleEngine.Builder builder)
builder - PebbleEngine.Builder instance to use.public PebbleModule(@Nonnull String templatesPath)
templatesPath - Template location to use. First try to file-system or fallback to
classpath.public PebbleModule()
views.Copyright © 2020. All rights reserved.