/dropwizard-soy

Soy template integration with Dropwizard

Primary LanguageJava

Dropwizard Soy Integration

Intro

This project is aimed to provide support for rendering soy templates from within a dropwizard project.

This project does not depend on the Dropwizard view libraries as they are explicity tied to freemarker and mustache.

The Dropwizard view module code was not in a place where different rendering implementations could be added cleanly, thus, there is a nominal amount of duplicated code here (a discussion on the topic).

Features

  • Realtime template compilation on change when developing locally (ie, when not running from shaded jar)

How to Use

  1. Build and install the parent module (mvn install)

  2. Include the core module as a maven dependency

    <dependency>
      <groupId>com.github.dwsoy</groupId>
      <artifactId>core</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
  3. Run core/bin/get-soy.sh to download and setup the soy templates dependency (ugh)

  4. Instantiate and add a SoyViewBundle to your bootstrap

  5. Add soy files under "soy" in your classpath (this is configurable). Preferred location would be under src/main/resources/soy.

  6. Return SoyView objects from your resources to render templates.

TODO

Javascript rendering support is not yet integrated.

The best way to go about this might often depend on the end implementation of DW, but I am open to suggestions