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 : 7
Users Yesterday : 1
Users Last 7 days : 19
Users Last 30 days : 58
Users This Month : 55
Users This Year : 983
Total Users : 1896
Views Today : 16
Views Yesterday : 1
Views Last 7 days : 34
Views Last 30 days : 86
Views This Month : 83
Views This Year : 2441
Total views : 4028
Who's Online : 0
Your IP Address : 216.73.216.201
Server Time : July 29, 2026 8:52 pm

