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

Using engine's instance for things such as partials #18

Closed
tbergeron opened this issue Apr 6, 2012 · 9 comments
Closed

Using engine's instance for things such as partials #18

tbergeron opened this issue Apr 6, 2012 · 9 comments

Comments

@tbergeron
Copy link

Hi!

I'm using Handlebars, and I'd like to use partials with it.

But to register partials, I must use that kind of code:

Handlebars.registerPartial("person", "<strong>hello</strong>");

For doing this, I need the engine's instance which after checking your code isn't returned in any way.

Do you have any idea of how I could use it, if there is no way do you think you could make that change? (I also could if you want me to)

Thanks a lot!

@tj
Copy link
Owner

tj commented Apr 6, 2012

hmm yeah it seems like a few engines expose similar APIs.. we could come up with a normalized way to expose the engines for now, it might be a bit tricky to unify some of these

@tbergeron
Copy link
Author

I agree about the unification part that could get a big complicated, but I'll check it out and try to figure something by myself and I'll submit it to you. Thanks!

@tj
Copy link
Owner

tj commented Apr 6, 2012

you should still be able to do var hbs = require('handlebars'); hbs.stuffhHere(), require() caches

@tbergeron
Copy link
Author

Yes! It worked!!! Thanks a lot!

@ghost
Copy link

ghost commented Apr 16, 2012

Is it possible to use partials with Hogan.js using this library?

I see that the partials go in the second parameter as part of their render function, but I'm unsure how to make use of it...

Thanks for your help.

@tj
Copy link
Owner

tj commented Apr 16, 2012

@dnglbr we just need some way to do that I guess, it's hard when these all have very different ideas of how to do things. Maybe we pass { partials: ... } and then delete options.partials

@ovaillancourt
Copy link
Contributor

Hogan.js support is pretty minimal at this moment... There's no caching/partial support if I'm not mistaken. (And partials must be already compiled when provided to hogan. Nothing limiting that on consolidate's side but to be taken into consideration...)

Maybe should the hogan.js support be put in a separate issue?

@tj
Copy link
Owner

tj commented Apr 16, 2012

yeah, I'm not well-aware of the internals of each engine so I was just doing my best to get them started. We'll have to make sure that all the features of each are accessible

@doowb
Copy link
Collaborator

doowb commented Apr 28, 2016

Engines can be retrieved from the .requires property. See this example in the readme.

For the Hogan question, if this is still an issue, please open a new issue (closing this due to age).

@doowb doowb closed this as completed Apr 28, 2016
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

4 participants