@Override
public void configure(final Env env, final Config conf, final Binder binder) {
JadeConfiguration jadeconf = new JadeConfiguration();
boolean dev = env.name().equals("dev");
boolean caching = conf.hasPath("jade.caching")
? conf.getBoolean("jade.caching")
: !dev;
boolean prettyPrint = conf.hasPath("jade.prettyprint")
? conf.getBoolean("jade.prettyprint")
: dev;
jadeconf.setCaching(caching);
jadeconf.setPrettyPrint(prettyPrint);
Map<String, Object> sharedVariables = new HashMap<>(2);
sharedVariables.put("env", env);
sharedVariables.put("xss", new XssHelper(env));
jadeconf.setSharedVariables(sharedVariables);
String ext = suffix.startsWith(".") ? suffix.substring(1) : suffix;
jadeconf.setTemplateLoader(new ClasspathTemplateLoader("UTF-8", ext));
if (callback != null) {
callback.accept(jadeconf, conf);
}
jadeconf.setTemplateLoader(new IOTemplateLoader(jadeconf.getTemplateLoader()));
binder.bind(JadeConfiguration.class)
.toInstance(jadeconf);
Multibinder.newSetBinder(binder, Renderer.class).addBinding()
.toInstance(new Engine(jadeconf, suffix));
}