Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make precompilation of templates possible. #16

Open
zorbash opened this issue May 29, 2013 · 1 comment
Open

Make precompilation of templates possible. #16

zorbash opened this issue May 29, 2013 · 1 comment

Comments

@zorbash
Copy link

zorbash commented May 29, 2013

Other javaScript templating engines support compiling the template text to a function which can then be called many times with different values without having the original template text be compiled again and again.

E.g in underscore templates:

    var compiled = _.template("hello: <%= name %>");
    compiled({name : 'moe'});
    "hello: moe"

Is there any "hidden" way you can do that with tim?

@premasagar
Copy link
Owner

@zorbash, unfortunately, there isn't currently a way to do this with tim. Everything is computed on-the-fly.

It's a good idea to have pre-computed templates, for performance, although I think it's likely that in most applications, the performance difference will be negligible. But no doubt there are situations where it will matter. I don't currently have any plans to implement it, but I'd happily review a pull request from someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants