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 : 0
Users Yesterday : 0
Users Last 7 days : 13
Users Last 30 days : 57
Users This Month : 17
Users This Year : 1180
Total Users : 2093
Views Today :
Views Yesterday :
Views Last 7 days : 30
Views Last 30 days : 99
Views This Month : 35
Views This Year : 3247
Total views : 4834
Who's Online : 0
Your IP Address : 216.73.216.198
Server Time : September 14, 2026 9:00 pm

