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 : 1
Users Last 7 days : 14
Users Last 30 days : 70
Users This Month : 66
Users This Year : 225
Total Users : 1138
Views Today : 1
Views Yesterday : 2
Views Last 7 days : 16
Views Last 30 days : 113
Views This Month : 108
Views This Year : 346
Total views : 1933
Who's Online : 0
Your IP Address : 216.73.216.134
Server Time : April 30, 2026 2:46 pm

