Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Question: how about a production-version of Twig.js? #80
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.
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.
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.