Resuing the component | Community
Skip to main content
AdobeID24
Level 5
Dec 28, 2020 2:32 PM UTC
Solved

Resuing the component

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.
Anudeep_Garnepudi
Anudeep_GarnepudiAccepted solution
New Participant
Dec 28, 2020 3:14 PM UTC

@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

6 replies

BrianKasingli
New Participant
Dec 28, 2020 10:00 PM UTC

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

 

Translate
Ankur_Khare
New Participant
Dec 28, 2020 3:24 PM UTC

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.

Translate
AdobeID24
AdobeID24Author
Level 5
Dec 29, 2020 5:05 AM UTC
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
Translate
Anudeep_Garnepudi
Anudeep_GarnepudiAccepted solution
New Participant
Dec 28, 2020 3:14 PM UTC

@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
Translate
AdobeID24
AdobeID24Author
Level 5
Dec 29, 2020 5:03 AM UTC
@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
Translate