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

Problem with throwing errors on require #59

Closed
ForbesLindesay opened this issue Sep 9, 2012 · 2 comments
Closed

Problem with throwing errors on require #59

ForbesLindesay opened this issue Sep 9, 2012 · 2 comments

Comments

@ForbesLindesay
Copy link
Contributor

We created a problem (entirely my fault) when we switched to the new API with rendering strings as an option. The issue is that when you render a file rather than a string, it can be impossible for an application to decide how to handle missing dependencies.

There are, as I see it, two options:

a) check that the engine exists before reading the file to pass to the render function, this would continue to allow us to throw a synchronous error.

b) catch the error, and pass it to the callback function

In addition to this, I wonder if you'd consider extending the api to include a dependencies array so that libraries using consolidate could (if they chose to) automatically install the needed dependencies.

@mikermcneil
Copy link

@ForbesLindesay We have a similar, although not identical issue, using consolidate directly in Sails. Our crappy short-term solution: https://github.com/balderdashy/sails/blob/v0.10/lib/hooks/views/consolidate.js

@ForbesLindesay
Copy link
Contributor Author

I solved it by writing: https://github.com/ForbesLindesay/transformers

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