Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 1.59 KB

README.md

File metadata and controls

54 lines (40 loc) · 1.59 KB

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.