Resuing the component | Community
Skip to main content
AdobeID24
Level 5
December 28, 2020
Solved

Resuing the component

  • December 28, 2020
  • 3 replies
  • 1954 views

Any Example of reusing one component A to make  90% identical component B ----> Most preferrally how we can do by using sling script resolution scheme ?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anudeep_Garnepudi

@adobeid24 

Make Component A as parent(sling:resourecSuperType) to Component B.

  1. Create Component B
  2. Delete all the resources under Component B (will get 100% inheritance)
  3. Add your override to Component B

3 replies

Anudeep_Garnepudi
Community Advisor
Anudeep_GarnepudiCommunity AdvisorAccepted solution
Community Advisor
December 28, 2020

@adobeid24 

Make Component A as parent(sling:resourecSuperType) to Component B.

  1. Create Component B
  2. Delete all the resources under Component B (will get 100% inheritance)
  3. Add your override to Component B
AG
AdobeID24
AdobeID24Author
Level 5
December 29, 2020
@anudeep_garnepudi ...Thanks for the reply ...yeah thats the classic way of doing that ..Actually I am more interested in some scenerio where two almost identical component A and B resuing the different different script by sling resolution method ...supoose product.test1.html..and product.test2.html...or one level inside the component and on same level script ...As we know thta nearest script to the resource getting callled will bebest match for the sling ...using that kind of facilities can we make two componnet //if you have any real time use case on that please let me know .Thanks
Ankur_Khare
Community Advisor
Community Advisor
December 28, 2020

Its same as we inherit any core component, so to reuse something u need to inherit the component and add the changes required for that component.

AdobeID24
AdobeID24Author
Level 5
December 29, 2020
Hi @ankur_khare , Thanks for the reply ...yeah thats the classic way of doing that ..Actually I am more interested in some scenerio where two almost identical component A and B resuing the different different script by sling resolution method ...supoose product.test1.html..and product.test2.html...or one level inside the component and on same level script ...As we know thta nearest script to the resource getting callled will bebest match for the sling ...using that kind of facilities can we make two componnet //if you have any real time use case on that please let me know .Thanks
BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 28, 2020

You can do this via AEM's component building concept, overlay. An example is what you asked, there's an old but effect video from youtube where you can see learn how to create an overlay component, https://www.youtube.com/watch?v=jmzLzvtCSWY&ab_channel=AEMandDevopsTutorial