Class PebbleModule

java.lang.Object
io.jooby.pebble.PebbleModule
All Implemented Interfaces:
Extension

public class PebbleModule extends Object implements Extension
Pebble module: https://jooby.io/modules/pebble.

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.

Since:
2.0.0
Author:
sojin
  • Constructor Details

    • PebbleModule

      public PebbleModule(@NonNull io.pebbletemplates.pebble.PebbleEngine.Builder builder)
      Creates a new pebble module.
      Parameters:
      builder - PebbleEngine.Builder instance to use.
    • PebbleModule

      public PebbleModule(@NonNull String templatesPath)
      Creates a new PebbleModule module.
      Parameters:
      templatesPath - Template location to use. First try to file-system or fallback to classpath.
    • PebbleModule

      public PebbleModule()
      Creates a new PebbleModule module using the default path: views.
  • Method Details