Ninja Framework + Rocker Templates

Integration of Rocker templates with the Ninja Framework. Rocker is a Java 8 optimized, near zero-copy rendering, speedy template engine that produces statically typed, plain java object templates that are compiled along with the rest of your project.

This project makes Rocker templates a first-class citizen to Ninja. All Ninja-specific functionality is provided by way of the N variable that is available to all templates. Here is a quick sample of what a index.rocker.html template would look like using a few of the most common Ninja features.

@import controllers.Application

@args (String title)

<!DOCTYPE html>
<html lang="en">
<head>
    <title>@title</title>
    <link rel='stylesheet' href='@N.webJarsAt("bootstrap/3.3.2-1/css/bootstrap.min.css")'>
    <link rel='stylesheet' href='@N.assetsAt("css/app.css")'>
</head>
<body>
    Hi!
    <a href='@N.reverseRoute(Application.class, "index")'/>Home</a>
</body>
<script type="text/javascript">
@if (N.isProd()) {
    /* production-only code (e.g. google analytics) */
}
</script>
</html>

Once compiled into your project, you can call this template from your Ninja controller. Fully type safe and compile-time checked.

public class Application {
    
    public Result index() {
        return Results.ok().render(
            views.index.template("Home")
        );
    }

}