3

I have different URL's in my sandbox and in my production environment. It is causing problems with my static resources in the css files. In my sandbox the community url is https://mydomain.com/partners, but in production the community url is https://mydomain.com. I hard coded the path of the static resource in the css file in the sandbox like this: url(/partners/resource/gothamhtf_medium_webfont_eot). But obviously in production this doesn't work. Is there a way that I can make it work in both environments?

Thanks in advance

1
  • I've had this problem before and only got round it by using the branding section of the community to add the location of the css again by hard coding. It might be possible to do it with a lightning template and fetch the url of the community dynamically. – Dave Humm Aug 15 '17 at 8:25
0

I had the same issue. The solution is to use the $Resource variable to pull the static resource, as opposed to using the whole path i.e /resource/myresource/files/picture.png

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/expr_resource_value_provider.htm?search_text=static

Example

{!$Resource.SLDS102 + '/assets/icons/utility-sprite/svg/symbols.svg#arrowdown'}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.