recommended clinetlibs & other folders in AEM 6.4 | Community
Skip to main content
Level 3
August 20, 2018

recommended clinetlibs & other folders in AEM 6.4

  • August 20, 2018
  • 2 replies
  • 7883 views

Hi all,

can anyone help on this below folders restructuring. This has been required for me to work on the 6.4 migrations.

1) etc/designs/myproject/clientlibs - right now I moved this to apps/myproject/clientlibs . but I'm worrying on this path since the dispatcher will block this path. I have refered this URL Using Client-Side Libraries  . This URL is useful if am referring a single image/js/css. But how should I refer a categories?

2) /etc/commerce/products/web/Default/en (before)- var/commerce/products/web/Default/en (after - is it aright path which I moved?)

3) /etc/commerce/products/web/Default/en (before)- - var/commerce/products/web/Default/en (after)

I also referred the blogs which is related my queries. But still i'm confused. Requesting those guys as well to help me here . wimsymonsprajwalreddysmacdonald2008 Arun Patidar  Appreciate your help.

regards,

Vijay

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

2 replies

arunpatidar
Community Advisor
Community Advisor
August 20, 2018

Hi,

Locating a Client Library Folder and Using the Proxy Client Libraries Servlet

In previous versions, client library folders were located below /etc/clientlibs in the repository. This is still supported, however it is recommended that client libraries now be located under /apps. This is to locate the client libraries near the other scripts, which are generally found below /apps and /libs.

Note:

In order to better isolate code from content and configuration, it is recommended to locate client libraries under /appsand expose them via /etc.clientlibs by leveraging the allowProxy property.

In order for the client libraries under /apps to be accessible, a proxy servelt is used. The ACLs are still enforced on the client library folder, but the servlet allows for the content to be read via /etc.clientlibs/ if the allowProxy property is set to true.

A static resource can only be accessed via the proxy, if it resides below a resource below the client library folder.

As an example:

  • You have a clientlib in /apps/myproject/clientlibs/foo
  • You have a static image in /apps/myprojects/clientlibs/foo/resources/icon.png

Then you set the allowProxy property on foo to true.

  • You can then request /etc.clientlibs/myprojects/clientlibs/foo.js
  • You can then reference the image via /etc.clientlibs/myprojects/clientlibs/foo/resources/icon.png

Caution:

When using proxied client libraries, the AEM Dispatcher configuration may require an update to ensure the URIs with the extension clientlibs are allowed.

More info

Using Client-Side Libraries

Arun Patidar
Level 3
August 20, 2018

Hi Arun,

Thanks for you response. You have referred this URL Using Client-Side Libraries  and even I have referred the same. My question is, if I have a folder(myapp) under etc/designs/myapp . And I gave the categories name as myapp.clientlib.all. In this case how should I handle the categories when I moved the clientlibs to apps/ folder. In the reference there is an example for single js & single img but not for categories.

Thanks,

Vijay

arunpatidar
Community Advisor
Community Advisor
August 20, 2018

Hi,

You can include clientlibs as you doing like <cq:includeClientLib categories="myapp.all"/> or

<sly data-sly-use.clientLib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientLib.css @ categories='myapp.all'}" data-sly-unwrap/>

Then the clientlib will then be proxied via <script type="text/javascript" src="/etc.clientlibs/myapp/clientlibs/all.js"></script>

Arun Patidar
smacdonald2008
Level 10
August 20, 2018

In AEM 6.4 - clientlibs is recommended to go under /apps. You should modify the Dispather so this is not blocked.