Skip to content

Instantly share code, notes, and snippets.

@eFrane
Last active December 25, 2015 11:59
Show Gist options
  • Save eFrane/6973266 to your computer and use it in GitHub Desktop.
Save eFrane/6973266 to your computer and use it in GitHub Desktop.
class JarStreamMustacheFactory extends DefaultMustacheFactory
{
String resourceRoot;
public JarStreamMustacheFactory(String resourceRoot)
{
super(resourceRoot);
if (!resourceRoot.endsWith("/")) resourceRoot += '/';
this.resourceRoot = resourceRoot;
}
public Mustache compile(String name)
{
if (name.charAt(0) == '/') name = name.substring(1,name.length());
InputStream stream = getClass().getResourceAsStream(resourceRoot + name + ".mustache");
return compile(new InputStreamReader(stream), name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment