expressjs / express

Fast, unopinionated, minimalist web framework for node.
https://expressjs.com
MIT License
64.33k stars 14.61k forks source link

refactor view engine #2217

Open jonathanong opened 10 years ago

jonathanong commented 10 years ago

it shoudl just be in its own library. i quickly hacked together https://github.com/expressjs/templation. some opinions would be nice.

a really good view engine is https://github.com/ericf/express3-handlebars, but the one express includes should be able to use most templating languages

defunctzombie commented 10 years ago

-1. Don't see a major win by pulling out out completely. We should remove the "app.render" and clean up some code but I don't see removing it as gaining much. It can still be a module, but we should include it.

jonathanong commented 10 years ago

Oh yeah separate module but still included

thomasfr commented 9 years ago

:+1: I saw that templation supports then-jade with kind of streaming support. Does this mean we could get real streaming views in express 5.x (of course we would also need a template engine which supports it correctly) ? :+1: for streaming views!

aredridel commented 9 years ago

I'd love to see streaming views. Of course, that's pretty much templateEngine(whatever).pipe(res)...

rlidwka commented 9 years ago

If you pull out view engine, how express would be any different from connect? :)

dougwilson commented 9 years ago

If you pull out view engine, how express would be any different from connect? :)

It means like the view engine would be a module, and express would require() that module and still use it--i.e. to the user, nothing would change, there'd still be views, etc. :)

rlidwka commented 9 years ago

It means like the view engine would be a module, and express would require() that module and still use it--i.e. to the user, nothing would change

Hmm... let me think... can I then include this view engine to my connect application, and get something like express without actually using express? :)

I don't quite remember why connect had gotten rid of, but if you modularize everything, I feel a lot of feature overlap there.

dougwilson commented 9 years ago

Hmm... let me think... can I then include this view engine to my connect application, and get something like express without actually using express? :)

Yes.

I don't quite remember why connect had gotten rid of, but if you modularize everything, I feel a lot of feature overlap there.

Well, I'm not 100% of the reasoning, but I eventually want to reconsider it for 5.x. We are also going to do the same thing for the router, so it would reason that express would be connect + views + router + other stuff. connect as it is is basically just .use(), which is the core of express as well. I have slowly been extracting the commonalities anyway :)

defunctzombie commented 9 years ago

There was already a lot of overlap and express was pretty highly coupled to connect. We removed connect because the router we wanted to ship got more complex than connect's basic .use middleware handling. On Jul 10, 2014 11:24 AM, "Douglas Christopher Wilson" < notifications@github.com> wrote:

Hmm... let me think... can I then include this view engine to my connect application, and get something like express without actually using express? :)

Yes.

I don't quite remember why connect had gotten rid of, but if you modularize everything, I feel a lot of feature overlap there.

Well, I'm not 100% of the reasoning, but I eventually want to reconsider it for 5.x. We are also going to do the same thing for the router, so it would reason that express would be connect + views + router + other stuff. connect as it is is basically just .use(), which is the core of express as well. I have slowly been extracting the commonalities anyway :)

— Reply to this email directly or view it on GitHub https://github.com/visionmedia/express/issues/2217#issuecomment-48619832 .

dougwilson commented 9 years ago

We removed connect because the router we wanted to ship got more complex than connect's basic .use middleware handling.

Yep, that's what I figured--, though in it's current state that no longer applies. I'll push up a branch with connect 3 at the express core that we can mull over.

Floby commented 9 years ago

I kind of made a streaming template engine a while ago called "blue"

Le 10 juil. 2014 17:31, "Douglas Christopher Wilson" < notifications@github.com> a écrit :

We removed connect because the router we wanted to ship got more complex than connect's basic .use middleware handling.

Yep, that's what I figured--, though in it's current state that no longer applies. I'll push up a branch with connect 3 at the express core that we can mull over.

— Reply to this email directly or view it on GitHub https://github.com/visionmedia/express/issues/2217#issuecomment-48620816 .

jonathanong commented 9 years ago

what's your views on templation? if it's good enough for 5.x i'll work on it some more. some help with more templating engines as well as collabs would be great

dougwilson commented 9 years ago

I have not taken a look at it just yet.

ilanbiala commented 9 years ago

Any progress on this? Streaming views would be pretty nice.

gdl276s commented 8 years ago

This may belong in another feature ticket, but I would prefer to couple view engines with view directories together in order to accommodate handling multiple view engines and multiple view directories within a single express app. For example ...

// hypothetical initialization
app.set('view engines', [
    { 'engine': 'jade', 'views': [ 'views/jade1', 'views/jade2' ] },
    { 'engine': 'handlebars', 'views': [ 'views/handlebards' ] }
]);