CDN 上的 Dojo 与自己安装的 Dojo

发布于 2024-08-14 16:28:04 字数 120 浏览 11 评论 0原文

我使用了相当多的 Dojo,但迄今为止我仅通过包含来自 AOL/Google 等 CDN 来使用它。

托管 Dojo 副本而不是通过 CDN 使用它有优势吗?我没有太多需要改变代码库,但我想还有其他优点/缺点?

I use quite a lot of Dojo, but to date I've only used it by including from a CDN such as AOL/Google.

Are there advantages to hosting a copy of Dojo rather than using it via a CDN? I don't have much need to alter the code base, but I imagine there are other advantages/disadvantages?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

已下线请稍等 2024-08-21 16:28:04

通过托管您自己的 Dojo 环境。例如,您可以自定义构建 dojo。所以你只需要加载一个*.js文件。这节省了 xhr 请求使用的流量。

-jstr

by hosting your own Dojo env. you are for example able to make a custom build of dojo. So you only need to load one *.js file. That saves traffic used by the xhr requests.

-jstr

我喜欢麦丽素 2024-08-21 16:28:04

在外部托管任何内容的缺点是您无法控制它。使用 Google/AOL CDN 不会出现此问题,但您可能会遇到与 BootyCall 在使用 Doug Crockfords 网站上的 json.js 时遇到的相同问题。 http://ajaxian.com/archives/doug- crockford-and-the-online-booty-call-saga

优点是您无需支付带宽费用,并且始终会添加正确的到期时间

Disadvantage to hosting anything externally is that you don't have control over it. You won't get this with the Google/AOL CDN but you could land up with the same issue that BootyCall got when using Doug Crockfords json.js from his site. http://ajaxian.com/archives/doug-crockford-and-the-online-booty-call-saga

Advantange is that you don't have to pay for bandwidth and will have the correct expiries added to it all the time

看海 2024-08-21 16:28:04

自定义构建+1。

我们在不保证能够访问互联网的产品中使用 Dojo,因此我们将 Dojo 嵌入到我们的产品中。

+1 for the custom build.

We use Dojo in a product that is not guaranteed to have access to the internet, so we ship with Dojo embedded as part of our product.

有深☉意 2024-08-21 16:28:04

难道不能将这两种方法结合起来吗?
我尝试将 dojoConfig 配置为具有以下 baseUrl //ajax.googleapis.com/ajax/libs/dojo/1.8.3/,同时脚本标记指向自定义 dojo 构建文件。
问题是,当我加载自定义 dojo.js 时,不会加载 NLS 文件(例如 dojo_en-US.js)。找不到解决方法。

在我看来,只要部署环境对 CDN 开放,这将是最好的解决方案,原因有几个(正如其他人已经说过的):
1.自定义dojo减少XHR并提高性能
2. 如果自定义构建不完整(有人添加了需求),XHR 的服务速度会更快
3. 有些资源(例如图片)无法嵌入到自定义构建中,因此首选从 CDN 加载它们
4.应用程序的打包和部署要快得多,因为它应该只包含dojo.js文件,而不是整个dojo释放资源。

如果有人能证明我错了并告诉我如何结合这两种方法,我会很高兴。

谢谢,
利奥尔

Isn't it possible to combine the two approaches?
I've tried to configure my dojoConfig to have the following baseUrl //ajax.googleapis.com/ajax/libs/dojo/1.8.3/, and at the same time the script tag points to a custom dojo build file.
The problem is, when I load the custom dojo.js the NLS files (e.g. dojo_en-US.js) are not loaded. Couldn't find a workaround.

As I see it, as long as the deployment environment is open to CDN, this would be the best solution, for several reasons (as others already stated):
1. Custom dojo reduces XHR and improves performance
2. In case custom build is incomplete (someone added a require), the XHR is served much faster
3. There are resources (such as images) that cannot be embedded in the custom build, and so loading them from CDN is preferred
4. Packaging and deployment of the application is much faster, because it should only contain the dojo.js file, and not the entire dojo release resources.

I would be happy if anyone could prove me wrong and tell me how can I combine the two approaches.

Thanks,
Lior

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文