问题描述
在我的使用ember-cli开发的应用程序中,我还需要一些外部资源,例如引导程序;
现在我正在通过Brocfile导入它:
In my app, developed using ember-cli, I need also some external resources like bootstrap;now I'm importing it through the Brocfile:
app.import('bower_components/bootstrap/dist/css/bootstrap.css');
app.import('bower_components/bootstrap/dist/js/bootstrap.js');
是否可以使用CDN代替本地文件,还可以定义对本地文件的回调CDN离线吗?
Is it possible to use a CDN instead of local file, defining also a callback to local file in case the CDN is offline?
推荐答案
听起来像是我的部分解决方案。这是自述文件的引文:
Ember-cli-cdn sounds like a partial solution to the problem to me. Here is a quote from the Readme:
但这不能解决如果CDN脱机则回退到本地文件的问题。我知道的唯一模式(也用在ember中)是将脚本加载放在html的末尾,即使CDN没有响应也允许页面呈现。
But it doesn't solve the "fallback to local file if CDN is offline" problem. The only pattern I am aware of (also used in ember) is to put the script loading at the end of the html allowing page rendering even if the CDN isn't responding.
这篇关于将CDN与ember-cli一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!