Expand my Community achievements bar.

SOLVED

Reference AEM as Cloud service versioned clientlibs in non-AEM pages like Magento

Avatar

Level 6

Hi All,

 

Is there a way to reuse AEM client-library with the versioning enabled in non-AEM pages like Magento?

 

This is a common use-case where we want to reuse the header/footer from AEM and show in external systems but the challenge has been to get the Client-library working. Some legacy implementations that I have seen use the Client-library path without the versioning identifier but this creates a caching issue every time there is an update in the Client-library code.

 

e.g. Right now, in Magento we need to hard-code the reference: /etc.clientlibs/site/components/header/v1/header/clientlibs.min.js

 

Instead, what's needed is something that works within AEM itself like 

/etc.clientlibs/site/components/header/v1/header/clientlibs.lc-c8983e582efc9345b4qoi89499f98b-lc.min.js and this identifier should be auto-updated every time there's a change within AEM.

 

Any recommendations on how to achieve this?

 

Thanks,

Ram

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @rampai 
Its look like you need the exact references.

But if you can disabled the browser/CDN cache for /etc.clientlibs/site/components/header/v1/header/clientlibs.min.js , I think this will work as well.

I believe with every cloud deployment all the cache(dispatcher, don't know about the Adobe CDN) deleted anyways.

 

Otherwise you have to expose clientlibs path from AEM as a data-attribute in the header/footer and then it can be loaded by external system



Arun Patidar

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @rampai 
You can either add your own cache buster like /etc.clientlibs/site/components/header/v1/header/clientlibs.lc-aem-magneto-mmhhddmmyyyy-lc.min.js.
where mmhhddmmyyyy can be aligned with AEM releases.

Another approach could be checking the bundle version/package version and adding to as a data arribute in header and then use that to load the js

/etc.clientlibs/site/components/header/v1/header/clientlibs.lc-<package-version>-lc.min.js.



Arun Patidar

Avatar

Level 6

Thank you @arunpatidar.

 

If I append an epoch string to the client-library it starts giving a 404. Problem is that random selector is not working in this case.

 

Regards,

Ram

Avatar

Correct answer by
Community Advisor

Hi @rampai 
Its look like you need the exact references.

But if you can disabled the browser/CDN cache for /etc.clientlibs/site/components/header/v1/header/clientlibs.min.js , I think this will work as well.

I believe with every cloud deployment all the cache(dispatcher, don't know about the Adobe CDN) deleted anyways.

 

Otherwise you have to expose clientlibs path from AEM as a data-attribute in the header/footer and then it can be loaded by external system



Arun Patidar