function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nicolas VuillamyNicolas Vuillamy 

How to access static resource from lightning component in Partner community ?

Hi :)

I tried lots of stuff but am now really stucked about the following problem: impossible to include a static resource in a lightning component when it is displayed in a Partner community ( using visual force page with inclusion of lightning )

My example is simple :
<aura:component controller="ccCmpUtils" extends="c:CmpRoot">
...
    <img src="/resource/PCLogoTwitter" width="36" height="36" alt="Twitter" />
...
</aura:component>

I have a static resource PCLogoFacebook which is a simple PNG image.
Its hardcoded link is https://xxxxxxx-dev-ed--c.na30.visual.force.com/resource/1456934890000/PCLogoTwitter

When I use this component from a force.com app ( URL https://xxxxxxxx-dev-ed.lightning.force.com/c/SomeApp.app ) , it is fetched and displayed correctly.

But then when I include it in a VF page like that ( end url = https://xxxxxxx-developer-edition.na30.force.com/PartnerXXX/apex/vfCmpAppIncluder?sfdc.tabName=01r360000000yt1 )
<apex:page standardStylesheets="false" sidebar="false">
    <apex:includeLightning />

    <div id="lightning" />

    <script>
        $Lightning.use("c:SomeApp", function() {
            $Lightning.createComponent("c:SomeComponent", // Component name
          {   // Component parameters
              'ShowHeader': false ,
              'ShowFooter' : false
          },
          "lightning",
          function(cmp) {
            // do some stuff
          });
        });
    </script> 
</apex:page>
I have a 404 error when getting the image because it looks in https://xxxxxxx-developer-edition.na30.force.com/PartnerXXX/resource/ instead than in base resource folder.

Has anyone already have this problem ?

Is there some way to solve it, other than to hardcode https://xxxxxxx-dev-ed--c.na30.visual.force.com/resource/1456934890000/PCLogoTwitter in my <img> tag ? ( this would make a component available for force.com OR community, but I need it to be includable in both )

Many thanks and best regards :)