ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Writer writer = new OutputStreamWriter(outputStream);
String content = Resources.toString(resource, Charsets.UTF_8);
MustacheFactory factory = new DefaultMustacheFactory();
factory.compile(new StringReader(content), resource.toString())
.execute(writer, scopes);
writer.close();
return outputStream.toString();
}