Activity › Forums › Salesforce® Discussions › How to include static resource in lightning component in Salesforce?
Tagged: Namespace, Salesforce Expressions, Salesforce Lightning Components, Static Resource, String Concatenation
-
How to include static resource in lightning component in Salesforce?
Posted by shradha jain on July 16, 2018 at 1:36 PMHow to include static resource in Lightning Component in Salesforce?
shariq replied 7 years, 7 months ago 3 Members · 2 Replies -
2 Replies
-
Hi Shradha
To reference a specific resource in component markup, use $Resource.resourceName within an expression. resourceName is the Name of the static resource. In a managed packaged, the resource name must include the package namespace prefix, such as $Resource.yourNamespace__resourceName. For a stand-alone static resource, such as an individual graphic or script, that’s all you need. To reference an item within an archive static resource, add the rest of the path to the item using string concatenation.
- [adinserter block='9']
-
Hi,
To use static resources in Lightning Application in salesforce, implement the application as follows:
<aura:application>
<link href=’/resource/bootstrap/’ rel=”stylesheet”/>
<div class=”navbar navbar-default navbar-static-top” role=”navigation”>
<div class=”container”>
<div class=”navbar-header”>
Lightning Contacts
</div>
</div>
</div><div class=”container”>
<div class=”row”>
<div class=”col-sm-12″>
Contact list goes here
</div>
</div>
</div></aura:application>
Hope this helps.
Log In to reply.