Open macsupport opened 7 years ago
No, not at the moment, but sounds like a nice optimization. What's your use case?
At the moment, you could always use the success
callback (https://github.com/codfish/jquery-data-remote/blob/master/README.md#success-function-default-successcallbacktarget-options-response) to handle the response anyway you want, and in your case use a compiled template.
You thinking something like this?
$.dataRemote({
...
template: Handlebars.compile( $("#tmpl1").html() ),
...
});
Rather than have to pass in the selector of the uncompiled template you could just pass in the compiled one and use it?
That was my thought on use. I am working on the website for the SPCA I work for (I'm a Veterinarian and a Geek) and trying to improve the loading speed as much as I can (due to an issue with only very large images being available to link to). I saw such an improvement in loading using handlebars and your script and though precompiling might be helpful. I'm also a bit of a novice with handlebars,, so I may be way off base on what it can do for loading, etc. Here is a link to a test page: http://www.yourvets.com Your script made it pretty easy to integrate the handlebars template. Thanks!
@macsupport no problem, thanks! I don't think you're way off there at all, this is a great optimization. According to handlebars, compilation is the most expensive part of the library.
eliminating client-side compilation will significantly speed up boot time, as compilation is the most expensive part of Handlebars.
This can also open up the opportunity to refactor the plugin to use different templating engines. I'm going to try and do it this week.
Is it possible to use a pre-compiled handlebars template?