koajs / koa-hbs

Handlebars templates for Koa.js
MIT License
159 stars 43 forks source link

streaming compiled html. #81

Open iAmServerless opened 6 years ago

iAmServerless commented 6 years ago

With the new renderToNodeStream React moved ahead by providing way to reduce TTFB and First paint.

Webpack generates assets which are appended to .hbs file using HtmlWebpackPlugin. React generate HTML on server using renderToString which is appended to .hbs using koa-hbs and sent to client.

To switch from renderToString to renderToNodeStream we need to separate .hbs in two parts, above and below some handlebar expression where react appends streaming data using renderToNodeStream.

With the current documentation of koa-hbs I do not found a way to get compiled html and take care of streaming by self.

Please expose an API to get comiled HTML or add support for streaming HTML.