nickel-org / nickel.rs

An expressjs inspired web framework for Rust
http://nickel-org.github.io/
MIT License
3.04k stars 157 forks source link

Chance to get handlebars templating work for nickel? #305

Open sunng87 opened 9 years ago

sunng87 commented 9 years ago

I haven't look into nickel much, but it seems the mustach template is hard-coded into the framework because the render function on response.

So, based on current design, is it possible to use handlebars or any other templating system?

Ryman commented 9 years ago

We recently extracted the mustache specific stuff to: https://github.com/Ryman/nickel-mustache with the aim of removing it from the core in the near future. It might be worth considering as a base to start a handlebars implementation for anyone interested. I definitely don't think it's impossible!

sidenote: It would be nice in future to have a templating system that could work with a number of renderers (depending on the file extensions, etc), but there's been no work towards that as far as I'm aware.

sunng87 commented 9 years ago

One solution is to make templating a middleware and let render returns something specific to downstream that templating middlewares will be interested in. Perhaps I will look into this if I got time.

zpallin commented 8 years ago

FYI, https://github.com/Ryman/nickel-mustache is alive and works, but it's falling behind nickel.

https://github.com/Ryman/nickel-mustache/pull/4

sunng87 commented 8 years ago

Thank you. I will look into the implementation to see if it's possible to make a similar one with handlebars.

jolhoeft commented 5 years ago

The nickel-mustache approach has be largely abandoned, and mustache is still integrated into nickel. If there is interest, I am open to revisiting this issue.