Load External CSS or JavaScript Libraries

To reference external CSS or an external JavaScript library that you’ve uploaded as a static resource, use the <ltng:require> tag in your .cmp or .app markup.

For example:

<ltng:require scripts="/resource/jsLibOne,/resource/jsLibTwo"
    styles="/resource/cssOne,/resource/cssTwo" afterScriptsLoaded="{!c.afterScriptsLoaded}"/>

The comma-separated lists of resources are loaded in the order that they are entered in the scripts and styles attributes.

The afterScriptsLoaded action in the client-side controller is called after the scripts are loaded.

To ensure encapsulation and reusability, add the <ltng:require> tag to every .cmp or .app resource that uses the CSS or JavaScript library.