That's correct. This is something I forgot to implement, but will definitely will fix for next release.
Until then, you are free to extend HandlebarsJsProcessor and override getArgument() method. The sample implementation can look like the one from DustJsProcessor:
@Override
protected String getArgument(Resource resource) {
final String name = resource == null ? "" : FilenameUtils.getBaseName(resource.getUri());
return String.format("'%s'", name);
}
Update the ProcessorsFactory with your custom implementation of HandlebarsJsProcessor. If you have question about how to do this, let me know.
Cheers,
Alex
On Thursday, 5 July 2012 04:18:25 UTC+3, Jason Corbett wrote:
I'm not super familiar with wro4j development, but it looks like this method may be the reason that I get null for the name:
in wro4j-extensions/src/main/java/ro/isdc/wro/extensions/processor/js/JsTemplateCompilerProcessor.java
50 /**
51 * @param resource
52 * {@link Resource} being processed by compiler.
53 * @return arguments consumed by the js compile script.
54 */
55 protected String getArgument(final Resource resource) {
56 return null;
57 }
On Wednesday, July 4, 2012 6:38:44 PM UTC-6,
jasonc...@gmail.com wrote:
Awesome, and thanks. The only issue I have is that the compiler always uses null as the name of the template. When I compile with the command line, it uses the name of the template file as the name. I looked at the code (wro4j-extensions/src/main/java/ro/isdc/wro/extensions/processor/support/handlebarsjs/HandlebarsJs.java, and the compile function takes a "name". How (or can I) get the name of the template set to the filename of the template file?
This is so exciting. I use wro4j to combine and compress javascript files at runtime for my project, and it works great, and makes development super easy. Handlebars support is wonderful. I just need the name of the template. Right now if you have more than one template, it overwrites the template with the last one compiled (all of the templates have the same name, null, so you only get the last one).
Jason Corbett