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

Question: how about a production-version of Twig.js? #80

Open
rkyoku opened this issue Apr 28, 2013 · 6 comments
Open

Question: how about a production-version of Twig.js? #80

rkyoku opened this issue Apr 28, 2013 · 6 comments
Labels

Comments

@rkyoku
Copy link

@rkyoku rkyoku commented Apr 28, 2013

Hi,

With Handlebars, one can grab a "production only" version of Handlebars that can only execute pre-compiled templates (server-side compiled).

It would be great to have the same thing with Twig.js. That way, the lib would weigh only a few kilobytes (instead of 66kB), and we could make the client download a "package" of all the templates altogether.

It would: save bandwidth, generate far fewer HTTP requests, and more importantly greatly reduce download time (important for me because I'm creating an app designed mostly for mobiles).

If it's already there, please forgive me for my question.

Best regards,

@justjohn
Copy link
Collaborator

@justjohn justjohn commented Apr 29, 2013

This is something I've been poking at for a while. I started work on a tool for generating compiled templates a while back (bin/twigjs) but haven't had time to complete it. The goal of that tool will be to write out JS files for each template that rely on, as you suggest, a small core twig.js file.

@rkyoku
Copy link
Author

@rkyoku rkyoku commented Apr 29, 2013

Don't you already have both features in the full lib? Please do forgive my naive question, but shouldn't you "just" (mind the quotes :) ) copy/paste the "compile()" function in the server-side lib that would allow to build a package of all the tpl, and the "render()" function in the client-side lib? I apologize if it is too naive of me.
Best regards,

@dcorb
Copy link

@dcorb dcorb commented May 11, 2016

+1

1 similar comment
@vergilius
Copy link

@vergilius vergilius commented Jun 1, 2016

+1

@dave-irvine
Copy link
Member

@dave-irvine dave-irvine commented Jun 1, 2016

I've taken a look at this as it would be quite helpful for me, but I definitely don't think it is as easy as it might first appear.

@mishoo
Copy link

@mishoo mishoo commented Mar 5, 2017

If anyone's still interested, I wrote a Twig->JS compiler. Whole new project though, I learned about this one half-through.

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

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.