How to include JavaScript from a CDN in meteor?

后端 未结 3 1052
孤城傲影
孤城傲影 2021-02-05 06:04

I\'d like to include JS from a CDN in Meteor before including my own client scripts so that the client scripts can depend on it.

...


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 06:17

    You can append the script after the template is rendered. So your script will load only after every other line has been loaded. For example if you directly add a jquery plugin to your template html file, you'll get "jquery not found" error. But this approach prevents that:

    Template.Main.onRendered(function () {
    
          $('head').append('');
    
    });
    

提交回复
热议问题