Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How much of <cq:includeClientLib js="cq.jquery" /> is necessary for user-facing site?

Avatar

Level 2

Hi,

We are including the <cq:includeClientLib js="cq.jquery" /> ClientLibrary in the <head> of our website and (it appears) to be rendering as below in the HTML source:

<!-- in typical AEM setup, is jquery-ui required on Author and/or website? --> <link rel="stylesheet" href="/etc/clientlibs/granite/jquery-ui.css" type="text/css"><link rel="stylesheet" href="/etc/clientlibs/foundation/jquery-ui/themes/default.css" type="text/css"><!-- /granite/jquery.js is fine to include on website --> <script type="text/javascript" src="/etc/clientlibs/granite/jquery.js"></script><!-- in typical AEM setup, are any of the below files required in Author and/or website? --><script type="text/javascript" src="/etc/clientlibs/granite/utils.js"></script><script type="text/javascript" src="/etc/clientlibs/granite/jquery/granite.js"></script><script type="text/javascript" src="/etc/clientlibs/foundation/jquery.js"></script><script type="text/javascript" src="/etc/clientlibs/granite/jquery-ui.js"></script><script type="text/javascript" src="/etc/clientlibs/foundation/jquery-ui.js"></script>

I'm trying to work out if any/all of the above files are really necessary for a user-facing website, or if in fact most are just required for the Author side of AEM. I am hoping somebody can advise, even based on a typical AEM setup, whether the cq.jquery ClientLibrary is usually needed on a user-facing site.
Based on my investigations so far it appears that the vast majority of the files are not needed for our website (apart from /granite/jquery.js). I have noticed that for example, there is a /granite/jquery-ui.js file and a /foundation/jquery-ui.js file - I am wondering if both or any are needed or if they are supposed to only be used in the Author environment.

Hope the above makes sense - I know every website is different but any help/advice would be appreciated.

Thanks very much in advance

Theo

1 Accepted Solution

Avatar

Correct answer by
Level 10

Yes Theo - All JS and CSS files in cq.jquery are required only on Author side.

~ Ratna.

View solution in original post

4 Replies

Avatar

Level 10

If you only want a specific version of JQuery - you can create your own client lib: 

https://helpx.adobe.com/experience-manager/using/integrating-jquery-framework-cq.html

You are correct in that most of the Granite APIs are used for touch ui on author side - not part of your site that is rendered on Publish. 

Avatar

Level 2

Thanks for your quick reply! So, just to confirm, all JS and CSS files in cq.jquery (apart from /granite/jquery.js) are only required for Author?

Thanks

Theo

Avatar

Correct answer by
Level 10

Yes Theo - All JS and CSS files in cq.jquery are required only on Author side.

~ Ratna.

Avatar

Level 2

Hi,

I have one more question regarding this - do I need to explicitly call the cq.jquery files to be used on Author or are they just built into AEM anyway? For example I could use an if statement to detect Edit or Design mode. Is this necessary?

Thanks

Theo