You need to sign in to do that
Don't have an account?
Mohammad Anis
Unable to Load .png file from Static Resources into .CSS of Aura Component.
I am trying to access the test.png file from my static resource into the .css of a aura component.
Working CSS: background:url('/resource/158765027200/test'); //resource path achieved using {!$Resource.test} in .cmp
Non-Working CSS: background:url('/resource/test');
Issue with the working CSS is that the static resource code is dynamic in nature and hence will vary from one salesforce instance to another, making this code non-ideal for deployment to other instances of salesforce.
Can anyone help me with this issue or any resolution. Thanks!
Working CSS: background:url('/resource/158765027200/test'); //resource path achieved using {!$Resource.test} in .cmp
Non-Working CSS: background:url('/resource/test');
Issue with the working CSS is that the static resource code is dynamic in nature and hence will vary from one salesforce instance to another, making this code non-ideal for deployment to other instances of salesforce.
Can anyone help me with this issue or any resolution. Thanks!
The below blogs might answer your query,
https://salesforce.stackexchange.com/questions/143630/refer-static-resource-in-css-of-lightning-component
https://developer.salesforce.com/forums/?id=906F0000000DEOCIA4
https://salesforce.stackexchange.com/questions/260010/how-to-add-background-image-to-lightning-component-body-from-static-resource
https://salesforce.stackexchange.com/questions/244266/loading-image-in-static-resource-within-css
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.