Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bordereast/ninja-pebble-module
Pebble Template integration for Ninja Framework
https://github.com/bordereast/ninja-pebble-module
java-8 maven ninjaframework pebble-templates
Last synced: 26 days ago
JSON representation
Pebble Template integration for Ninja Framework
- Host: GitHub
- URL: https://github.com/bordereast/ninja-pebble-module
- Owner: bordereast
- Created: 2017-11-20T01:26:22.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-21T12:11:36.000Z (almost 7 years ago)
- Last Synced: 2024-09-29T16:41:18.048Z (about 1 month ago)
- Topics: java-8, maven, ninjaframework, pebble-templates
- Language: Java
- Size: 104 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## ninja-pebble-module
Pebble Template integration for Ninja web frameworkUpdated Pebble module for Ninja framework. Java 8, Ninja 6.2.0. Allows configuration of most Pebble options including the Syntax.
### Install
```
com.bordereast.ninja
pebble-module
0.0.2```
### Usage
In your conf/Module.java, install the module:
```java
@Override
protected void configure() {
install(new PebbleModule());
}
```Also in conf/Module.java, add this `@Provides` method. The `NinjaExtensionService` gets injected into the module and allows you to pass in custom extensions.
```java
@Provides
NinjaExtensionService provideNinjaExtensionService() {
NinjaExtensionService service = new NinjaExtensionService();
// add custom extensions here:
service.addExtension(new CustomExtension());
return service;
}
```Rename your views to remove the `.ftl` if you want and change the Freemarker syntax to Pebble.
Create the `views/error/500internalServerError.html` file with these contents (or customize as you like):
```html
500 Internal Server Error
```
### Configure
The following configuration is available via conf/application.conf[See Pebble Engine Settings for more info](http://www.mitchellbosecke.com/pebble/documentation/guide/installation)
```
# You can leave these out if not changing these defaults
ninja.template.pebble.fileExt=.html
ninja.template.pebble.managedContentType=text/html
ninja.template.pebble.500ErrorViewLocation=views/error/500internalServerError.html
ninja.template.pebble.cacheActive=true
ninja.template.pebble.executorServiceClass=CachedThreadPool
ninja.template.pebble.poolSize=-1
inja.template.pebble.strictVariables=false
ninja.template.pebble.defaultLocale=en-US
# Syntax options
ninja.template.pebble.delimiterCommentOpen={#
ninja.template.pebble.delimiterCommentClose=#}
ninja.template.pebble.delimiterExecuteOpen={%
ninja.template.pebble.delimiterExecuteClose=%}
ninja.template.pebble.delimiterPrintOpen={{
ninja.template.pebble.delimiterPrintClose=}}
ninja.template.pebble.whitespaceTrim=-
```**ninja.template.pebble.executorServiceClass**
One of (`CachedThreadPool`, `FixedThreadPool`, `ScheduledThreadPool`, `SingleThreadScheduledExecutor`, `WorkStealingPool`)**ninja.template.pebble.poolSize**
`-1` if one of (`CachedThreadPool`, `SingleThreadScheduledExecutor`) or > 0 if one of (`FixedThreadPool`, `ScheduledThreadPool`) and either `-1` or > `0` for (`WorkStealingPool`)For example:
```
ninja.template.pebble.executorServiceClass=ScheduledThreadPool
ninja.template.pebble.poolSize=5
```