Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM6.5 referencing external js in clientlib

Avatar

Level 7

Hi ,

 

I have 2 js scripts in header of html  which we are adding as 

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/ angular.min.js "></script>;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

 

 

So want to add this to clientlibs of aem, but wanted to know instead of copying the whole js code inside the clientlibs . Is there any way I could reference this js with just urls and still gets  these added clientlibs of aem.

 

The idea in case they the 3party scripts if there is any code change in js it will automatically get reflected instead of making a code change again

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @srinivas_chann1,

We need to define the source files of desired JS libraries in clientlibs.

Referencing JS with URLs is possible only with <script> tag which is the case for HTML. 

Note : jQuery library that ships with AEM OOTB is included as source files of specific version in clientlibs.

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @srinivas_chann1,

We need to define the source files of desired JS libraries in clientlibs.

Referencing JS with URLs is possible only with <script> tag which is the case for HTML. 

Note : jQuery library that ships with AEM OOTB is included as source files of specific version in clientlibs.