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

Allow access to native template features #64

Closed
philwhineray opened this issue Dec 27, 2016 · 2 comments
Closed

Allow access to native template features #64

philwhineray opened this issue Dec 27, 2016 · 2 comments
Labels
accepted An accepted request or suggestion enhancement A minor feature request request Request for new functionality
Milestone

Comments

@philwhineray
Copy link

At present the Handlebars and Tera template functionality is fully encapsulated.

It is likely that users will choose one based on features unique to that engine. Rocket should be able to expose the appropriate objects to make those features available.

See PR #60 for initial discussion.

@SergioBenitez SergioBenitez added accepted An accepted request or suggestion enhancement A minor feature request request Request for new functionality labels Dec 27, 2016
@SergioBenitez SergioBenitez added this to the 0.4.0 milestone Dec 27, 2016
@kardeiz
Copy link

kardeiz commented Jul 21, 2017

I'm feeling this limitation too.

I think an acceptable resolution would be to just make rocket_contrib::templates::Context public. Then users could write their own fairing, which could modify e.g. Tera through context.engines.tera after calling Context::initialize, and then add the Context to Rocket state.

Context doesn't seem to contain any information that must be kept private. It's not ideal to make users set the templates directory manually (as in my scenario above), but is not that difficult, and that part of Template::fairing could be abstracted out into a Template::root function.

@seanlinsley
Copy link

I've submitted a new PR if anyone wants to try it out: #500.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted An accepted request or suggestion enhancement A minor feature request request Request for new functionality
Projects
None yet
Development

No branches or pull requests

4 participants