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).