Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using CDN with ember-cli

Tags:

cdn

ember-cli

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?

like image 756
Cereal Killer Avatar asked Nov 01 '22 16:11

Cereal Killer


1 Answers

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.

like image 104
Ole Roel Avatar answered Jan 04 '23 13:01

Ole Roel