gpt4 book ai didi

cdn - 将 CDN 与 ember-cli 结合使用

转载 作者:行者123 更新时间:2023-12-01 17:21:04 28 4
gpt4 key购买 nike

在我的应用程序中,使用 ember-cli 开发,我还需要一些外部资源,例如 bootstrap;现在我通过 Brocfile 导入它:

app.import('bower_components/bootstrap/dist/css/bootstrap.css');
app.import('bower_components/bootstrap/dist/js/bootstrap.js');

是否可以使用 CDN 代替本地文件,并在 CDN 离线时定义对本地文件的回调?

最佳答案

Ember-cli-cdn对我来说听起来像是问题的部分解决方案。以下是自述文件中的引用:

This addon allows to work with local copies of libraries during development, and then automate switching to your CDN version when you deploy your application.

但它并没有解决“如果 CDN 离线则回退到本地文件”的问题。我知道的唯一模式(也在 ember 中使用)是将脚本加载放在 html 末尾,即使 CDN 没有响应也允许页面呈现。

关于cdn - 将 CDN 与 ember-cli 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26187268/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com