-
Notifications
You must be signed in to change notification settings - Fork 276
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
Runtime only? #530
Comments
I'm working on this, for what it's worth. Hoping to have a PR soon. |
@dave-irvine I've been working on this in my fork, on the no-compiler branch: https://github.com/mortenson/twig.js/tree/no-compiler It splits parsing/compiling+loading methods into different files, and creates a new bundle (twig.production.min.js) that's about 28k smaller than twig.min.js, and seems to work. Tests are also passing. Is this something that you would want me to add new test coverage for and submit a PR? The restructuring required to accomplish this was intensive so I want to make sure this is a direction you'd be interesting in going. |
@mortenson my role here is now mostly that of glorified PR accepter and build publisher :) if what you have works, and you've added tests for it, as long as you will be happy to support it to some degree if it turns out to break something existing, I don't have a problem putting it in. Try @'img some of the more active members and see if they have input. @willrowe @olets (I'm on mobile so no autocomplete on names) |
This is an interesting idea. It would be great to have an example of how this could be used, I'm especially interested in how the pre-compiled templates would be delivered to the parser. |
@willrowe I wrote some in the README, and the test coverage shows an example as well. A quick way to see this working is to set up a Webpack project with twig-loader, mark |
Thanks, I'll take a look over this when I get a chance. |
Sounds neat! I think willrowe's in a better position than me to evaluate this one |
If the project is eventually moved towards more modern ES modules, that should resolve this issue. |
Hi there,
Checking Twig-like isomorphic template engines, and found twig.js
It seemed to finally compile (when specifying every argument, especially the
--pattern
argument).But then I wondered: where is the runtime library? Since the compiled templates seem to refer to a
twig()
function, it seems I need a runtime of some kind.But even just the twig.core.js file weighs around 50kB.
What file(s) am I supposed to include to render a precompiled template?
Thanks a lot,
The text was updated successfully, but these errors were encountered: