Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember include external JS via external HTTP server

Tags:

ember.js

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?

like image 822
Prakash Raman Avatar asked Nov 30 '25 16:11

Prakash Raman


1 Answers

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>"
  }
}
like image 100
ykaragol Avatar answered Dec 08 '25 23:12

ykaragol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!