什么是javascript的服务器端呈现? [英] What is server side rendering of javascript?

查看:165
本文介绍了什么是javascript的服务器端呈现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些像Dust.js这样的javascript框架声称他们也支持服务器端渲染(除了客户端渲染)。有人可以解释这是如何工作的?我的理解是JS总是在浏览器运行时执行。

Some javascript frameworks like Dust.js claim that they ALSO support server-side rendering (in addition to client side rendering) as well. Can someone explain how does this work? My understanding is that the JS is always executed in the browser runtime.

推荐答案

可以使用像 Node.js 。

关于 Dust.js ,一个模板引擎,它可以在服务器上生成超文本和HTML,并将该内容直接发送到客户的浏览器。这通常用于避免闪存的临时空模板,这是由于浏览器需要一秒钟来通过Dust.js这样的框架填充视图的模板。缺点是页面加载时间稍长,因为在向客户端发送数据之前必须在服务器上完成更多工作。

With regard to Dust.js, a templating engine, it can generate hypertext and HTML on the server and send that content directly to the client's browser. This is typically used to avoid a flash of temporarily empty templates, caused by the browser requiring a split second to populate a view's templates via a framework like Dust.js. The downside is that the page will take slightly longer to load because more work has to be done on the server before sending data to the client.

签出这个问题了解服务器端rending的优缺点。必须在慢速后处理(要求用户的浏览器完成工作)或减慢预处理(使服务器在用户看到任何内容之前完成工作)之间做出选择。

Check out this question for the pros and cons of server-side rending. One must choose between slow post-processing (requiring the user's browser to do the work) or slow pre-processing (making the server do the work before the user sees anything).

这篇关于什么是javascript的服务器端呈现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆