-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat: add support for async compiling #42
base: master
Are you sure you want to change the base?
Conversation
The build is failing✨ Good work on this PR so far! ✨ Unfortunately, the Travis CI build is failing as of c58982a. Here's the output:
|
I think the tests are wrong. The test assumes that template.fn(locals) returns a string. Hence the test I also made a PR for the tests: jstransformers/test-jstransformer#50 |
jstransformer-nunjucks doesn't support asynchronous rendering, but nunjucks does, as explained in issue #35.
The basic jstransformer library looks for
compileAsync
, just before it defaults to thecompile
method as a final resort whencompileFileAsync
is called. This PR implementcompileAsync
Nunjucks uses callbacks for asynchronous support, but jstransformer expects promises. Therefor the render function is denodified, which means that the render functions is wrapped in a promise, and the callback resolves the promise.