Prakash Raman
Prakash Raman

Reputation: 13943

Ember include external JS via external HTTP server

I would like to include this library (Bootbox) . It does have a an npm package, but I would like to include it via its CDN (public url).

What is the right way to include external javascript (and css) files which reside on publicly accessible servers?

Upvotes: 3

Views: 185

Answers (1)

ykaragol
ykaragol

Reputation: 6221

If you don't want it in your vendor.js file, the only way I know is to import it in your index.html. Just place it in your index.html with a script tag.

By the way, you can create an addon, that only has an index.js that implements the content-for hook. This hook can insert the script tag for you. e.g:

contentFor:function(type, config){
  if(type==='head'){ //or body, choose the appropriate one for you
    return "<script src='...'></script>"
  }
}

Upvotes: 2

Related Questions