Using CDN with ember-cli

不打扰是莪最后的温柔 提交于 2019-12-06 02:44:46

问题


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');

Is it possible to use a CDN instead of local file, defining also a callback to local file in case the CDN is offline?


回答1:


Ember-cli-cdn sounds like a partial solution to the problem to me. Here is a quote from the Readme:

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.

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.



来源:https://stackoverflow.com/questions/26187268/using-cdn-with-ember-cli

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!