I have a lightning component that's enabled for community builder (site.com). It uses some static resources, unfortunately the normal relative static resource path doesn't work in a Site.com context so if I use :


In the Site.com site the static resource is not found. So far the only solution I've found is hard coding the full path:


This is obviously not a good solution for components I intend to include in a managed package where the salesforce domain will change.

What is the best way to generate the static resource path in the tag so that it will work in all possible Lightning component contexts:

  • SF1
  • Site.com
  • Lightning App Builder
  • Lightning Components in Visualforce

and any other contexts I might have missed that can use lightning components?

1 Answer 1


We need to add required files under assets to access them in site.com. Seems like we can't directly use static resource from salesforce.

Manage --> Administration --> Go to site.com studio --> Assets --> import

After importing script files, we can refer them as below:

<ltng:require scripts="/Jquery.js"/>
  • It's just a pain to have to keep them in two places and site.com doesn't handle zip files very nicely. It tries to unzip them and put them where it thinks the files should be losing the folder hierarchy which is less than helpful. I was actually mistaken. The resources are accessible it's the /s on the community site that's messing things up. You can access the static resources with ../resource/myresource/myresourcepath Aug 25, 2015 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .