捆绑.js文件VS CDN [英] Bundling .js files vs CDN

查看:122
本文介绍了捆绑.js文件VS CDN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了改善我们的网页的性能,我们建议使用 CDN s到服务在我们的网页的.js 文件。这是有道理的。

In order to improve performance of our web pages, we are recommended to use CDNs to serve .js files on our web pages. That makes sense.

此外,我们建议捆绑以减少正被向服务器发出的对负载的请求的数量提供了的.js 的文件。

Also, we are recommended to bundle our .js files in order to reduce the number of requests which are being made to server on load.

因此​​,我们需要坐下来,让之间,如果我们使用CDN或捆绑的.js 文件的决定。

So, we need to sit down and make decision between if we use CDN or bundle .js files.

有什么利弊?哪些更有意义?

What are the pros and cons? Which ones make more sense?

推荐答案

为什么你不能捆绑他们的将它们是CDN?它应该难言一方或另一方的决定?

Why can't you bundle them and place them are the CDN? It should hardly be a decision of one or the other?

如果您包含,以选择一个或另一个,这取决于你是包括多少的.js 文件。对于一个小的文件,我想的建议的一个CDN会更快,其中,作为文件的数量更多,一捆的.js 文件将绝对更快。当切换会,是东西给你进行试验。

If you have to choose one or the other, it depends on how many .js files you are including. For a small number of files, I'd suggest that a CDN would be quicker, where-as for a greater number of files, a bundle of .js files would definitely be quicker. Where the switch-over would be, is something for you to experiment with.

这篇关于捆绑.js文件VS CDN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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