How to use Salesforce Resources in Lightning Web Component?
Salesforce Resource | Syntax to use |
---|---|
Static Resource | import sampleResource from '@salesforce/resourceUrl/resourceReference'; Only, we need to enter Static Resource Name in the place of resourceReference and then refer to the property in JS file.If there is a specific namespace in your org, please put the Static Resource Name with the namespace i.e., namespace__StaticResourceName. |
Custom Label | import labelName from '@salesforce/label/labelReference'; Only, we need to enter Custom Label Name with namespace in the place of labelReference and then refer to the property in JS file. If there is no specific namespace in your org, please put the Custom Label Name with default namespace c. |
Current User Id | import userId from '@salesforce/user/Id'; |
SVG Resource | We can directly write down the SVG in template of the HTML file using |
10,185 total views, 3 views today