What is the purpose of $ContentAsset provider? Why can't $Resource always be used? Is there any point of storing images, style sheets, and JavaScript in some other places rather than in StaticResources?

I am struggling to understand the purpose of $ContentAsset provider. Is this provider to reach some Static Resources loaded not into Static Resources but somewhere in community builder or some other place? Is that related to Asset standard object or is this stored in completely different standard object?

What is the purpose of this functionality if everyone could use Static Resources and $Resource to reference images, style sheets, and JavaScript assets?


$ContentAsset represents a Global value that a component can use in expressions. Lightning Components can be used in many places, not just within an Org on Lightning and Visualforce Pages. They can also be used in external Communities and in other places outside of Salesforce when configured using Lightning Out. Depending on the use case, resources and content needed by a component could be stored in very different locations other than as part of an org's static resources. $ContentAsset allows components to access their resources from these other locations.

  • Do you mean that external Communities can't access Static Resources? – Patlatus Feb 11 '19 at 9:37
  • Communities generally store their assets in a different location than the internal org and use Community Builder rather than Setup. – crmprogdev Feb 11 '19 at 14:50
  • @crmprogdev, can you please give an example of these other locations? – Eduard Apr 15 '19 at 7:29
  • 1
    @Eduard I think I did in my answer. LightningOut can store resources pretty much any place including a secure site that supports a Landing Page for Marketing Cloud. Communities can store their resources in a different location than Static Resources. I hope that clarifies it further for you. – crmprogdev Apr 15 '19 at 13:36

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.