How can i use external JS and CSS stored at CDN in lightning components? I believe aura:clientLibrary is the tag to do the same. But i couldn't find its documentation to use it. Am refering the below mentioned stackexchange question to load the css.

Lightning: What is the difference between ltng:require and aura:clientLibrary


To reference an external CSS resource, use a <ltng:require> tag. But I believe you can not add files from CDN. As per Salesforce documentation "CDNs are not allowed at this point because they are outside of Salesforce data centers and can’t be controlled." This has more stringent security requirements, in that you have to load the JavaScript via a static resource rather than an external CDN from the likes of Google or Microsoft.

  • I agree,then why there is aura:clientLibrary and stackoverflow answer stating we can load from external domain. – Pranay Jaiswal Oct 20 '15 at 4:26
  • An old question, but I thought I'd add an update. You can access external CDNs, as of the Winter '17 release, with <ltng:require>. Not sure about prior releases. – scarabaeus Sep 29 '16 at 19:43
  • can you write new answer with description? So I can mark it as correct and everyone will be able to benefit from it? – Pranay Jaiswal Sep 30 '16 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.