September 20, 2023
Syntax: import myXyzResource from ‘@salesforce/resourceUrl/yourNamespace__resourceReference’;
*created static resource named mysource and converted the folder containing image file into zip file and uploaded it.
*if you have folders inside your main folder then add the path like this. Ex- I have images folder inside mysource folder then put like this.
mylogo = mysource + ‘/images/logo.jpg’;
staticResourceLWC.html
<template>
<lightning-card title="Static Resource LWC Example" >
<div class="slds-m-around_medium">
<img src={mylogo}>
</div>
</lightning-card>
</template>
staticResourceLWC.js
import { LightningElement } from 'lwc';
import mysource from '@salesforce/resourceUrl/mysource';
export default class StaticResourceLWC extends LightningElement {
mylogo = mysource + 'logo.jpg';
}
Latest Post
About Me
Welcome to an Aimer's weblog :)
Hi! Asif Parvez here, I'm from West Bengal's Howrah. I have extensive experience in Apex, Integration (REST API), LWC, ADMIN and working as Senior Salesforce Developer for Dazeworks Technologies(An iLink Digital Company). I am also a content creator and blogger.
I have three certifications(PD-I, PD-II, Salesforce Associate).
Our Visitor
Our Visitor
Users Today : 1
Users Yesterday : 6
Users Last 7 days : 142
Users Last 30 days : 282
Users This Month : 156
Users This Year : 531
Total Users : 1444
Views Today : 1
Views Yesterday : 22
Views Last 7 days : 439
Views Last 30 days : 763
Views This Month : 473
Views This Year : 1142
Total views : 2729
Who's Online : 0
Your IP Address : 216.73.216.231
Server Time : June 14, 2026 8:24 pm

