Skip to content

An example Javalin app using Rocker as its template engine

Notifications You must be signed in to change notification settings

Playacem/javalin-rocker-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

javalin-rocker-example

This example shows how to add Rocker to a Javalin app.

Adding Rocker as a dependency

Adding the runtime dependency

First one needs to add the Rocker runtime to their dependencies. For maven it looks something like this:

<dependencies>
    <dependency>
        <groupId>com.fizzed</groupId>
        <artifactId>rocker-runtime</artifactId>
        <version>${rocker.version}</version>
    </dependency>

    <!-- for hot-reloading support only during development -->
    <dependency>
        <groupId>com.fizzed</groupId>
        <artifactId>rocker-compiler</artifactId>
        <version>${rocker.version}</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Replace ${rocker.version} with the current version of Rocker. See Rocker on maven central for more details.

Adding the compiler plugin

See the official Rocker readme for details on how to do this. Rocker also supports Gradle.

Using Kotlin with Rocker

Add the following line to the sourceDirs configuration of the Kotlin Maven plugin:

<sourceDir>${project.basedir}/target/generated-sources/rocker</sourceDir>

Hints

As of Javalin 4 there is no support for double extension files. The extension .html is used for the integration. This overrides Javalin's support for Thymeleaf. For everything to work correctly template files have to end in with .rocker.html.

About

An example Javalin app using Rocker as its template engine

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published