3

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?

1 Answer 1

2

$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.

7
  • Do you mean that external Communities can't access Static Resources? Commented Feb 11, 2019 at 9:37
  • Communities generally store their assets in a different location than the internal org and use Community Builder rather than Setup. Commented Feb 11, 2019 at 14:50
  • 1
    @crmprogdev, can you please give an example of these other locations? Commented Apr 15, 2019 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. Commented Apr 15, 2019 at 13:36
  • @crmprogdev, it seems that $ContentAsset can do the same as Static Resource plus it can be available externally. It brings up a question of why do we need static resources at all? We can now use Content assets for all use cases. Correct? Commented Mar 26, 2021 at 12:29

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.